File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -244,8 +244,16 @@ def outer():
244
244
self .assertIsInstance (sys .exception (), ValueError )
245
245
self .assertIsInstance (sys .exception ().__context__ , TypeError )
246
246
yield next (g )
247
+ # at this point the TypeError from the caller has been handled
248
+ # by the caller's except block. Even still, it should still by
249
+ # referenced as the __context__ of the current exception.
247
250
self .assertIsInstance (sys .exception (), ValueError )
248
- self .assertIsInstance (sys .exception (), TypeError )
251
+ self .assertIsInstance (sys .exception ().__context__ , TypeError )
252
+ # not handling an exception, caller isn't anymore either
253
+ self .assertIsNone (sys .exception ())
254
+ with self .assertRaises (StopIteration ):
255
+ next (g )
256
+ self .assertIsNone (sys .exception ())
249
257
250
258
g = outer ()
251
259
next (g )
You can’t perform that action at this time.
0 commit comments