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.

作者 xdegaye
收信人 brett.cannon, pitrou, serhiy.storchaka, vstinner, xdegaye
日期 2017-06-22.15:41:53
SpamBayes Score -1.0
Marked as misclassified
Message-id <1498146114.53.0.968075075561.issue30697@psf.upfronthosting.co.za>
In-reply-to
内容
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>
历史
日期 用户 动作 参数
2017-06-22 15:41:54xdegaye修改recipients: + xdegaye, brett.cannon, pitrou, vstinner, serhiy.storchaka
2017-06-22 15:41:54xdegaye修改messageid: <1498146114.53.0.968075075561.issue30697@psf.upfronthosting.co.za>
2017-06-22 15:41:54xdegaye链接issue30697 messages
2017-06-22 15:41:53xdegaye创建