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
2f84b64 to
4dcbd8f
Compare
| @@ -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) { | |||
There was a problem 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?
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
A guard against infinite loop.
| @@ -306,18 +313,17 @@ PyErr_NormalizeException(PyObject **exc, PyObject **val, PyObject **tb) | |||
| } | |||
| /* normalize recursively */ | |||
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Update this comment perhaps?
…sion. (python#2035) MemoryError raised when normalizing a RecursionError raised during exception normalization now not always causes a fatal error.
https://bugs.python.org/issue28994