"Martin v. Löwis" [mailto:martin at v.loewis.de] wrote: > > I'm actually surprised that the exception is cleared when the > function that has the exception handler completes. Where does that > happen? The current exception is in the thread state, not in the > frame, after all. eval_frame calls set_exc_info and reset_exc_info to do a save/restore to the frame object. Effectively there's a stack of exceptions, but since it's bound to frames interesting cases like this occur: try: point_A except: try: point_B except: pass raise ==> NameError: name 'point_B' is not defined (Refugees from C++ might expect the 'point_A' exception instead.) Method extraction brings the frame object into play for a different result: def b(): try: point_B except: pass try: point_A except: b() raise ==> NameError: name 'point_A' is not defined - Anders
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4