[issue15106] Potential Bug in errors.c

Irit Katriel report at bugs.python.org
Sat Jan 2 20:06:44 EST 2021


Irit Katriel <iritkatriel at yahoo.com> added the comment:

The code is not really cloned - note that PyErr_Restore is operating on tstate->curexc (the exception currently being handled) while PyErr_SetExcInfo is operating on tstate->exc_info (the earliest exception currently on the exception stack).

If there is a bug here, I think it is the silent conversion of traceback to NULL in the case where it is neither NULL nor Py_None. (The case in PyErr_Restore that the comment says should not happen).

Otherwise, the difference is that PyErr_Restore transforms Py_None to NULL for the traceback, and PyErr_SetExcInfo doesn't.  That conversion seems neither necessary nor wrong.

----------
nosy: +iritkatriel
versions: +Python 3.10 -Python 3.4

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue15106>
_______________________________________


More information about the Python-bugs-list mailing list