This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author pitrou
Recipients ajaksu2, amaury.forgeotdarc, barry, benjamin.peterson, brett.cannon, nnorwitz, pitrou, theller
Date 2008-08-30.00:05:39
SpamBayes Score 1.2475881e-08
Marked as misclassified No
Message-id <1220054746.41.0.123882814625.issue2548@psf.upfronthosting.co.za>
In-reply-to
Content
Ok, here is a patch which seems to cover all bases. It fixes the present
bug, adds tests for the aforementioned ex-crashers, backports the
somewhat smarter recursion checking from py3k, and improves the latter
by fixing a nasty recursion bug when exceptions are ignored by C code.

I have to explain the latter problem a bit. Some functions like
PyDict_GetItem() are designed to silence all exceptions. If a
RuntimeError is raised because of a recursion overflow, however, a flag
(named "overflowed") is additionally set in the thread state structure;
this flag temporarily bumps the recursion_limit by 50, so that the  code
which caught the exception can perform some cleanup without itself
getting into the recursion limit. However, if recursion_limit + 50 is in
turned reached, the interpreter aborts with a fatal error.

Now, if the RuntimeError is discarded by PyDict_GetItem(), the
"overflowed" flag must also be reset, because the caller won't know that
there was a recursion overflow and that it must clean up. Instead, it
will simply assume the requested value is not in the dict, and will
continue happily... until it overflows the recursion limit again, which
will trigger the aforementioned fatal error if "overflowed" has not been
reset.

Consequently, PyErr_Clear() now resets the "overflowed" flag if the
current recursion count has gone back below the recursion limit. This
improvement must also be merged back to py3k.

Of course, we may also decide that all those subtle changes are not
worth the risk, just to fix a few obscure glitches.
History
Date User Action Args
2008-08-30 00:05:46pitrousetrecipients: + pitrou, barry, nnorwitz, brett.cannon, theller, amaury.forgeotdarc, ajaksu2, benjamin.peterson
2008-08-30 00:05:46pitrousetmessageid: <1220054746.41.0.123882814625.issue2548@psf.upfronthosting.co.za>
2008-08-30 00:05:44pitroulinkissue2548 messages
2008-08-30 00:05:43pitroucreate