Xavier de Gaye added the comment:
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>
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue30697>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com