diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2013-05-01 19:48:25 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2013-05-01 19:48:25 -0400 |
commit | e2a1f56295f3d54473245a8e02bb158c79eb402f (patch) | |
tree | 870df88cd87de945898d8e487e7d45df51b0f93f /coverage/parser.py | |
parent | 4d75f332969a55aa9a3f12546b9d2c9feec1a18a (diff) | |
download | python-coveragepy-git-e2a1f56295f3d54473245a8e02bb158c79eb402f.tar.gz |
Add some debugging for branch issues.
Diffstat (limited to 'coverage/parser.py')
-rw-r--r-- | coverage/parser.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/coverage/parser.py b/coverage/parser.py index a4fa6f65..832f27ac 100644 --- a/coverage/parser.py +++ b/coverage/parser.py @@ -418,6 +418,13 @@ class ByteParser(object): for _, l in bp._bytes_lines(): yield l + def _block_stack_repr(self, block_stack): + """Get a string version of `block_stack`, for debugging.""" + blocks = ", ".join( + ["(%s, %r)" % (opcode.opname[b[0]], b[1]) for b in block_stack] + ) + return "[" + blocks + "]" + def _split_into_chunks(self): """Split the code object into a list of `Chunk` objects. @@ -508,6 +515,7 @@ class ByteParser(object): if block_stack: # A break that goes through a finally will jump to whatever # block is on top of the stack. + # print self._block_stack_repr(block_stack) chunk.exits.add(block_stack[-1][1]) # For the finally clause we need to find the closest exception # block, and use its jump target as an exit. |