Author xdegaye
Recipients brett.cannon, pitrou, serhiy.storchaka, vstinner, xdegaye
Date 2017-06-22.15:41:53
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1498146114.53.0.968075075561.issue30697@psf.upfronthosting.co.za>
In-reply-to
Content
PR 2327 lacks the test cases mentionned below for the moment.

1) With PR 2327, the memerr.py script runs correctly:

$ ./python /path/to/memerr.py
Fatal Python error: Cannot recover from MemoryErrors while normalizing exceptions.

Current thread 0x00007f37eab54fc0 (most recent call first):
  File "/path/to/memerr.py", line 8 in foo
  File "/path/to/memerr.py", line 13 in <module>
Aborted (core dumped)

2) With PR 2327, exceeding the recursion limit in PyErr_NormalizeException() raises a RecursionError:

$ ./python -q
>>> import _testcapi
>>> raise _testcapi.RecursingInfinitelyError
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
RecursionError: maximum recursion depth exceeded while normalizing an exception
>>>

Note that when the infinite recursion is started by instantiating an exception written in Python code instead, the RecursionError is set by Py_EnterRecursiveCall() instead of by PyErr_NormalizeException().

3) With PR 2327, the test case in PR 1981 runs correctly (so PR 2327 fixes also issue 22898):

$ ./python /path/to/crasher.py    # crasher.py is the code run by test_recursion_normalizing_exception() in PR 1981
Done.
Traceback (most recent call last):
  File "/path/to/crasher.py", line 36, in <module>
    recurse(setrecursionlimit(depth + 2) - depth - 1)
  File "/path/to/crasher.py", line 19, in recurse
    recurse(cnt)
  File "/path/to/crasher.py", line 19, in recurse
    recurse(cnt)
  File "/path/to/crasher.py", line 19, in recurse
    recurse(cnt)
  [Previous line repeated 1 more times]
  File "/path/to/crasher.py", line 21, in recurse
    generator.throw(MyException)
  File "/path/to/crasher.py", line 25, in gen
    yield
RecursionError: maximum recursion depth exceeded while calling a Python object
sys:1: ResourceWarning: unclosed file <_io.FileIO name='/path/to/crasher.py' mode='rb' closefd=True>
History
Date User Action Args
2017-06-22 15:41:54xdegayesetrecipients: + xdegaye, brett.cannon, pitrou, vstinner, serhiy.storchaka
2017-06-22 15:41:54xdegayesetmessageid: <1498146114.53.0.968075075561.issue30697@psf.upfronthosting.co.za>
2017-06-22 15:41:54xdegayelinkissue30697 messages
2017-06-22 15:41:53xdegayecreate