[Python-Dev] Is it safe to call PyEval_EvalFrameEx() with an exception set? (original) (raw)

Antoine Pitrou solipsis at pitrou.net
Tue Jul 16 09:57:50 CEST 2013


Le Tue, 16 Jul 2013 02:34:49 +0200, Victor Stinner <victor.stinner at gmail.com> a écrit :

Hi,

I'm working on the issue #18408 (fix issues found by my pyfailmalloc tool). To analyze some bugs, I have to add debug traces in various functions to find which function returned NULL without setting an error, or the opposite: returned a valid object, but with an exception set. 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 PyEvalEvalFrameEx() 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":

Regards

Antoine.



More information about the Python-Dev mailing list