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

Irit Katriel report at bugs.python.org
Fri Aug 6 11:18:15 EDT 2021


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

Serhiy's patch is modifying a different part of this system - he changes the Exception object's SetContext to break cycles when they are first created. Dennis and I targeted the place where an exception is about to be raised and it gets a __context__ that may contain a cycle already.

I think it's possible to take the more drastic step of preventing the cycles being created altogether, as Serhiy did. I would prefer that we raise an exception and refuse to create the cycle rather than try to fix it.  I don't think we can come up with a meaningful fix to what is, really, a user bug.

In any case, at the moment we have a situation where user bugs (like Issue40696) can cause the interpreter to hang, and if we need more time to decide about the full strategy, we should at least prevent the hang.

----------

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


More information about the Python-bugs-list mailing list