summaryrefslogtreecommitdiff
path: root/coverage/debug.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2016-09-24 19:08:50 -0400
committerNed Batchelder <ned@nedbatchelder.com>2016-09-24 19:08:50 -0400
commit813bf6c33bc33f171efde49047b766c407f0c9e8 (patch)
treebc5da359109a6dfba343a81051cd45ed32e38600 /coverage/debug.py
parent72c2df9297550e92dd85493dcfada7020340ff6c (diff)
downloadpython-coveragepy-813bf6c33bc33f171efde49047b766c407f0c9e8.tar.gz
Clean up and test the callers debugging info
Diffstat (limited to 'coverage/debug.py')
-rw-r--r--coverage/debug.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/coverage/debug.py b/coverage/debug.py
index 3d67c61..d173f43 100644
--- a/coverage/debug.py
+++ b/coverage/debug.py
@@ -49,7 +49,7 @@ class DebugControl(object):
msg = "pid %5d: %s" % (os.getpid(), msg)
self.output.write(msg+"\n")
if callers and self.should('callers'):
- dump_stack_frames(out=self.output)
+ dump_stack_frames(out=self.output, skip=1)
self.output.flush()
def write_formatted_info(self, header, info):
@@ -109,10 +109,10 @@ def short_stack(limit=None, skip=0):
return "\n".join("%30s : %s @%d" % (t[3], t[1], t[2]) for t in stack)
-def dump_stack_frames(limit=None, out=None): # pragma: debugging
+def dump_stack_frames(limit=None, out=None, skip=0):
"""Print a summary of the stack to stdout, or some place else."""
out = out or sys.stdout
- out.write(short_stack(limit=limit))
+ out.write(short_stack(limit=limit, skip=skip+1))
out.write("\n")
@@ -121,7 +121,7 @@ def log(msg, stack=False): # pragma: debugging
with open("/tmp/covlog.txt", "a") as f:
f.write("{pid}: {msg}\n".format(pid=os.getpid(), msg=msg))
if stack:
- dump_stack_frames(out=f)
+ dump_stack_frames(out=f, skip=1)
def enable_aspectlib_maybe():