[proxy] web.archive.org← back | site home | direct (HTTPS) ↗ | proxy home | ◑ dark◐ light
/ cpython Public

Conversation

Copy link
Member

serhiy-storchaka commented Jun 9, 2017

serhiy-storchaka force-pushed the PyErr_NormalizeException-nonrecursive branch from 2f84b64 to 4dcbd8f Compare June 11, 2017 16:48
Python/errors.c Outdated
@@ -306,18 +313,17 @@ PyErr_NormalizeException(PyObject **exc, PyObject **val, PyObject **tb)
}
/* normalize recursively */
tstate = PyThreadState_GET();
if (++tstate->recursion_depth > Py_GetRecursionLimit()) {
--tstate->recursion_depth;
if (++recursion_depth > Py_GetRecursionLimit() - tstate->recursion_depth) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the function isn't recursive anymore, is there any reason you're still bothering with recursion_depth?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A guard against infinite loop.

Python/errors.c Outdated
@@ -306,18 +313,17 @@ PyErr_NormalizeException(PyObject **exc, PyObject **val, PyObject **tb)
}
/* normalize recursively */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update this comment perhaps?

serhiy-storchaka merged commit cf29653 into python:master Nov 5, 2017
serhiy-storchaka deleted the PyErr_NormalizeException-nonrecursive branch November 5, 2017 09:27
embray pushed a commit to embray/cpython that referenced this pull request Nov 9, 2017
…sion. (python#2035)

MemoryError raised when normalizing a RecursionError raised during exception normalization now not always causes a fatal error.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip news type-feature A feature request or enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants