[issue25782] CPython hangs on error __context__ set to the error itself

Irit Katriel report at bugs.python.org
Fri Aug 6 10:47:21 EDT 2021


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

Like Dennis' patch, mine changes PyErr_SetObject. The difference is that Dennis' patch gets rid of the cycle while mine leaves it as it is, just avoids hanging on it.

So in this case:

    when trying to set the exception A on top of
        B -> C -> D -> E -> C -> ...,

The result would be simply

        A -> B -> C -> D -> E -> C -> ...,

As I said in msg391637, a pre-existing cycle is due to a bug somewhere, and I don't think PyErr_SetObject can or should try to fix that bug.  Nonsense in, nonsense out. If we change it we probably just make it more nonsensical.

----------

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


More information about the Python-bugs-list mailing list