[issue4040] ignored exceptions in generators (regression?)

Antoine Pitrou report at bugs.python.org
Mon Oct 6 15:46:04 CEST 2008


Antoine Pitrou <pitrou at free.fr> added the comment:

This is not specific to generators, this is due to the fact that a lot
of recursion checks have been added all over the place. When an internal
function designed to ignore exceptions (for example
PyErr_GivenExceptionMatches()) encounters such a recursion overflow, it
ignores it and prints it out. Such a function designed to ignore
exceptions can perfectly be called after a recursion overflow has
already happened, and that's what you witness here: the first
RuntimeError is raised, and soon enough that exception is given to
PyErr_GivenExceptionMatches() (perhaps because `for` has to detected
StopIteration's) where the recursion count overflows again
(`__subclasscheck__` can incur recursion so there is a recursion guard),
and the subsequent exception is ignored and printed out.

2.5 doesn't have the problem because many recursion checks have been
added between 2.5 and 2.6.

3.0 doesn't have the problem because its recursion checking code tries
to be smart (but it has other problems).

See the message I've sent to python-dev some time ago:
http://mail.python.org/pipermail/python-dev/2008-August/082106.html

----------
nosy: +pitrou

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


More information about the Python-bugs-list mailing list