Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f572cbf commit e5862f7Copy full SHA for e5862f7
3 files changed
Lib/test/test_sys_settrace.py
@@ -1077,6 +1077,29 @@ def func():
1077
(1, 'line'),
1078
(1, 'return')])
1079
1080
+ def test_no_tracing_of_named_except_cleanup(self):
1081
+
1082
+ def func():
1083
+ x = 0
1084
+ try:
1085
+ 1/x
1086
+ except ZeroDivisionError as error:
1087
+ if x:
1088
+ raise
1089
+ return "done"
1090
1091
+ self.run_and_compare(func,
1092
+ [(0, 'call'),
1093
+ (1, 'line'),
1094
+ (2, 'line'),
1095
+ (3, 'line'),
1096
+ (3, 'exception'),
1097
+ (4, 'line'),
1098
+ (5, 'line'),
1099
+ (7, 'line'),
1100
+ (7, 'return')])
1101
1102
1103
class SkipLineEventsTraceTestCase(TraceTestCase):
1104
"""Repeat the trace tests, but with per-line events skipped"""
1105
Python/compile.c
@@ -3312,11 +3312,11 @@ compiler_try_except(struct compiler *c, stmt_ty s)
3312
/* second # body */
3313
VISIT_SEQ(c, stmt, handler->v.ExceptHandler.body);
3314
compiler_pop_fblock(c, HANDLER_CLEANUP, cleanup_body);
3315
+ /* name = None; del name; # Mark as artificial */
3316
+ UNSET_LOC(c);
3317
ADDOP(c, POP_BLOCK);
3318
3319
ADDOP(c, POP_EXCEPT);
- /* name = None; del name; # Mark as artificial */
- UNSET_LOC(c);
3320
ADDOP_LOAD_CONST(c, Py_None);
3321
compiler_nameop(c, handler->v.ExceptHandler.name, Store);
3322
compiler_nameop(c, handler->v.ExceptHandler.name, Del);
@@ -3348,7 +3348,6 @@ compiler_try_except(struct compiler *c, stmt_ty s)
3348
return 0;
3349
3350
3351
3352
UNSET_LOC(c);
3353
3354
Python/importlib_zipimport.h
@@ -1403,8 +1403,8 @@ const unsigned char _Py_M__zipimport[] = {
1403
23,35,13,20,20,29,30,34,30,42,44,53,20,54,13,17,
1404
20,24,13,17,16,26,13,54,17,39,28,43,44,48,50,57,
1405
59,67,69,77,79,83,28,84,21,25,21,25,0,0,17,39,
1406
- 24,35,17,39,17,39,17,39,17,39,36,39,21,33,21,39,
1407
- 21,39,21,39,21,39,21,39,0,0,0,0,0,0,0,0,
+ 24,35,17,39,17,39,17,39,17,39,36,39,21,33,21,33,
+ 21,33,21,33,21,33,21,33,0,0,0,0,0,0,0,0,
1408
0,0,24,39,40,47,49,53,24,54,17,21,16,20,24,28,
1409
16,28,13,25,17,25,23,32,33,34,23,35,13,20,20,24,
1410
26,35,37,44,20,44,13,44,13,44,13,44,12,24,9,83,
0 commit comments