File tree Expand file tree Collapse file tree 3 files changed +35
-4
lines changed
Misc/NEWS.d/next/Core and Builtins Expand file tree Collapse file tree 3 files changed +35
-4
lines changed Original file line number Diff line number Diff line change @@ -1137,6 +1137,38 @@ def func():
11371137 (7 , 'line' ),
11381138 (7 , 'return' )])
11391139
1140+ def test_tracing_exception_raised_in_with (self ):
1141+
1142+ class NullCtx :
1143+ def __enter__ (self ):
1144+ return self
1145+ def __exit__ (self , * excinfo ):
1146+ pass
1147+
1148+ def func ():
1149+ try :
1150+ with NullCtx ():
1151+ 1 / 0
1152+ except ZeroDivisionError :
1153+ pass
1154+
1155+ self .run_and_compare (func ,
1156+ [(0 , 'call' ),
1157+ (1 , 'line' ),
1158+ (2 , 'line' ),
1159+ (- 5 , 'call' ),
1160+ (- 4 , 'line' ),
1161+ (- 4 , 'return' ),
1162+ (3 , 'line' ),
1163+ (3 , 'exception' ),
1164+ (2 , 'line' ),
1165+ (- 3 , 'call' ),
1166+ (- 2 , 'line' ),
1167+ (- 2 , 'return' ),
1168+ (4 , 'line' ),
1169+ (5 , 'line' ),
1170+ (5 , 'return' )])
1171+
11401172
11411173class SkipLineEventsTraceTestCase (TraceTestCase ):
11421174 """Repeat the trace tests, but with per-line events skipped"""
Original file line number Diff line number Diff line change 1+ Restore behavior from 3.10 when tracing an exception raised within a with
2+ statement.
Original file line number Diff line number Diff line change @@ -5093,10 +5093,7 @@ MISS_WITH_OPARG_COUNTER(STORE_SUBSCR)
50935093 JUMPTO (handler );
50945094 /* Resume normal execution */
50955095 frame -> f_state = FRAME_EXECUTING ;
5096- frame -> f_lasti = handler ;
5097- NEXTOPARG ();
5098- PRE_DISPATCH_GOTO ();
5099- DISPATCH_GOTO ();
5096+ DISPATCH ();
51005097 }
51015098
51025099exiting :
You can’t perform that action at this time.
0 commit comments