2013/7/16 Antoine Pitrou <solipsis at pitrou.net>: > Le Tue, 16 Jul 2013 02:34:49 +0200, > Victor Stinner <victor.stinner at gmail.com> a écrit : >> I would like to add assertions in Python/ceval.c to detect such bugs >> earlier. The problem is that some functions rely on the ability to >> call PyEval_EvalFrameEx() with an exception set. Is it expected? >> Should it be avoided? > > Well, if your frame is a generator frame, you must be able to throw() > into it, i.e. resume it with an exception set. > > The difficulty here is that there are different meanings for "an > exception is set": > - PyErr_Occurred() is true > - the f_exc_type field and friends are set > - possibly another one that I'm forgetting about Ah yes, a generator can call PyEval_EvalFrameEx() with an exception set (PyErr_Occurred() is non-NULL), but it sets throwflag to 1. My question is when an exception is set (PyErr_Occurred() is non-NULL) at the beginning of the bytecode evaluation loop. Just after the "goto error;" in this extract of ceval.c: if (throwflag) /* support for generator.throw() */ goto error; for (;;) { ... } Victor
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