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

Dennis Sweeney report at bugs.python.org
Sat May 30 16:33:09 EDT 2020


Dennis Sweeney <sweeney.dennis650 at gmail.com> added the comment:

For clarification, the existing behavior on master:
    When trying to raise the exception H,
        F -> G -> H -> I -> NULL
    becomes
        H -> F -> G -> NULL

    But when trying to set the exception A on top of
        B -> C -> D -> E -> C -> ...,
        it gets stuck in an infinite loop from the existing cycle.

My PR 20539 keeps the first behavior and resolves the infinite loop by making it
    A -> B -> C -> D -> E -> NULL,
    which seems consistent with the existing behavior.

So it should be strictly a bugfix. It also only changes the PyErr_SetObject code and not the PyException_SetContext code.

----------
nosy: +Dennis Sweeney

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


More information about the Python-bugs-list mailing list