Skip to content

Commit a357c3d

Browse files
committed
fixed subtle bug in cumulative_mode when there's an exception
1 parent e5ddfa3 commit a357c3d

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

‎v3/pg_logger.py‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -651,11 +651,11 @@ def interaction(self, frame, traceback, event_type):
651651

652652
# debug ...
653653
'''
654-
print >> sys.stderr, '=== STACK ==='
654+
print >> sys.stderr
655+
print >> sys.stderr, '=== STACK ===', 'curindex:', self.curindex
655656
for (e,ln) in self.stack:
656657
print >> sys.stderr, e.f_code.co_name + ' ' + e.f_code.co_filename + ' ' + str(ln)
657658
print >> sys.stderr, "top_frame", top_frame.f_code.co_name
658-
print >> sys.stderr
659659
'''
660660

661661

@@ -743,7 +743,13 @@ def interaction(self, frame, traceback, event_type):
743743

744744

745745
# only render zombie frames that are NO LONGER on the stack
746-
cur_stack_frames = [e[0] for e in self.stack]
746+
#
747+
# subtle: self.stack[:self.curindex+1] is the real stack, since
748+
# everything after self.curindex+1 is beyond the top of the
749+
# stack. this seems to be relevant only when there's an exception,
750+
# since the ENTIRE stack is preserved but self.curindex
751+
# starts decrementing as the exception bubbles up the stack.
752+
cur_stack_frames = [e[0] for e in self.stack[:self.curindex+1]]
747753
zombie_frames_to_render = [e for e in self.zombie_frames if e not in cur_stack_frames]
748754

749755

0 commit comments

Comments
 (0)