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

Jack O'Connor report at bugs.python.org
Wed Dec 2 13:59:08 EST 2015


Jack O'Connor added the comment:

Yury, do we need to handle more complicated infinite loops, where "self" doesn't actually show up in the loop? Here's an example:

    try:
        raise Exception
    except Exception as ex:
        loop1 = Exception()
        loop2 = Exception()
        loop1.__context__ = loop2
        loop2.__context__ = loop1
        ex.__context__ = loop1
        hasattr(1, 'aa')

I'm unfamiliar with CPython, so I don't know whether full-blown loop detection belongs here. Maybe we could add a hardcoded limit like "fail if we loop more than X times"?

----------
nosy: +oconnor663

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


More information about the Python-bugs-list mailing list