Commits

anatoly techtonik  committed f7ac7fe

Make Debug.caller_stack() return full stack.

Previously it required to specify all needed levels as parameters,
which is not practical. Now it return list of filename:line(function)
strings starting from the root one.

  • Participants
  • Parent commits a90f3d8

Comments (0)

Files changed (1)

File src/engine/SCons/Debug.py

             return res[4]
 
 # returns caller's stack
-def caller_stack(*backlist):
+def caller_stack():
     import traceback
-    if not backlist:
-        backlist = [0]
+    tb = traceback.extract_stack()
+    # strip itself and the caller from the output
+    tb = tb[:-2]
     result = []
-    for back in backlist:
-        tb = traceback.extract_stack(limit=3+back)
-        key = tb[0][:3]
+    for back in tb:
+        # (filename, line number, function name, text)
+        key = back[:3]
         result.append('%s:%d(%s)' % func_shorten(key))
     return result