Antoine Pitrou <[EMAIL PROTECTED]> added the comment: 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. ---------- keywords: +patch Added file: http://bugs.python.org/file11313/excrecurse.patch _______________________________________ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue2548> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com