(1, 'line'),
(1, 'return')])
+ def test_no_tracing_of_named_except_cleanup(self):
+
+ def func():
+ x = 0
+ try:
+ 1/x
+ except ZeroDivisionError as error:
+ if x:
+ raise
+ return "done"
+
+ self.run_and_compare(func,
+ [(0, 'call'),
+ (1, 'line'),
+ (2, 'line'),
+ (3, 'line'),
+ (3, 'exception'),
+ (4, 'line'),
+ (5, 'line'),
+ (7, 'line'),
+ (7, 'return')])
+
+
class SkipLineEventsTraceTestCase(TraceTestCase):
"""Repeat the trace tests, but with per-line events skipped"""
/* second # body */
VISIT_SEQ(c, stmt, handler->v.ExceptHandler.body);
compiler_pop_fblock(c, HANDLER_CLEANUP, cleanup_body);
- ADDOP(c, POP_BLOCK);
- ADDOP(c, POP_EXCEPT);
/* name = None; del name; # Mark as artificial */
c->u->u_lineno = -1;
+ ADDOP(c, POP_BLOCK);
+ ADDOP(c, POP_EXCEPT);
ADDOP_LOAD_CONST(c, Py_None);
compiler_nameop(c, handler->v.ExceptHandler.name, Store);
compiler_nameop(c, handler->v.ExceptHandler.name, Del);
return 0;
VISIT_SEQ(c, stmt, handler->v.ExceptHandler.body);
compiler_pop_fblock(c, HANDLER_CLEANUP, cleanup_body);
- /* name = None; del name; # Mark as artificial */
c->u->u_lineno = -1;
ADDOP(c, POP_EXCEPT);
ADDOP_JUMP(c, JUMP_FORWARD, end);