Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bpo-28994: PyErr_NormalizeException() no longer recursive. #2035

Conversation

Projects
None yet
3 participants
@serhiy-storchaka
Copy link
Member

serhiy-storchaka commented Jun 9, 2017

@serhiy-storchaka serhiy-storchaka force-pushed the serhiy-storchaka:PyErr_NormalizeException-nonrecursive branch from 2f84b64 to 4dcbd8f Jun 11, 2017

@@ -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) {

This comment has been minimized.

Copy link
@pitrou

pitrou Jun 13, 2017

Member

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

This comment has been minimized.

Copy link
@serhiy-storchaka

serhiy-storchaka Jun 14, 2017

Author Member

A guard against infinite loop.

@@ -306,18 +313,17 @@ PyErr_NormalizeException(PyObject **exc, PyObject **val, PyObject **tb)
}
/* normalize recursively */

This comment has been minimized.

Copy link
@pitrou

pitrou Jun 13, 2017

Member

Update this comment perhaps?

@serhiy-storchaka serhiy-storchaka merged commit cf29653 into python:master Nov 5, 2017

4 checks passed

bedevere/issue-number Issue number 28994 found
Details
bedevere/news "skip news" label found
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

@serhiy-storchaka serhiy-storchaka deleted the serhiy-storchaka:PyErr_NormalizeException-nonrecursive branch Nov 5, 2017

embray added a commit to embray/cpython that referenced this pull request Nov 9, 2017

bpo-28994: PyErr_NormalizeException() no longer use C stack for recur…
…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
You can’t perform that action at this time.