summaryrefslogtreecommitdiff
path: root/coverage/parser.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2013-05-01 19:48:25 -0400
committerNed Batchelder <ned@nedbatchelder.com>2013-05-01 19:48:25 -0400
commit897619e30049ab501de92ddec6cbe2fe77beccd5 (patch)
tree52dc197cc36f7c851c8511c2f51bb974af0093e1 /coverage/parser.py
parenta312df7bf66ae3eac76b36415395b4f665196bab (diff)
downloadpython-coveragepy-897619e30049ab501de92ddec6cbe2fe77beccd5.tar.gz
Add some debugging for branch issues.
Diffstat (limited to 'coverage/parser.py')
-rw-r--r--coverage/parser.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/coverage/parser.py b/coverage/parser.py
index a4fa6f6..832f27a 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.