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

Serhiy Storchaka report at bugs.python.org
Wed Dec 2 15:39:53 EST 2015


Serhiy Storchaka added the comment:

> What to do when you try to chain "C -> C"?

Nothing. Or may be raise an exception (because C.__context__ can't be set to what you try).

> you expected one type of exception, then you used some external library, and after that you have a completely different exception.

I don't understand what new can add the reordering. It doesn't change original exception, it only changes __context__, but you change it in any case. If silently ignore the loop, you would get __context__ different from what you expected. If raise TypeError, you would get TypeError instead of expected exception.

And if the decision will be to raise TypeError, may be RuntimeError is more appropriate?

----------

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


More information about the Python-bugs-list mailing list