2013/7/16 Victor Stinner <victor.stin...@gmail.com>:
> 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? The current exception can be replaced with a new
> exception.

Another example. Py_ReprLeave() function can be called while an
exception is set. I'm not sure that it is "safe" to call new code
while an exception is set.

The function can raise a new exception. For example, PyList_SetSlice()
can fail because of a MemoryError.

I modified Py_ReprLeave() to save and then restore the current exception:
http://hg.python.org/cpython/rev/28ff7ac91477

If Py_ReprLeave() raises a new exception, it is clears (replaced by
the previous exception context).

Victor
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to