Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(1137)

Unified Diff: Python/ceval.c

Issue 6028: Interpreter crashes when chaining an infinite number of exceptions
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Python/ceval.c
===================================================================
--- Python/ceval.c (revision 72313)
+++ Python/ceval.c (working copy)
@@ -601,17 +601,19 @@
return 0;
if (tstate->overflowed) {
if (tstate->recursion_depth > recursion_limit + 50) {
- /* Overflowing while handling an overflow. Give up. */
- Py_FatalError("Cannot recover from stack overflow.");
+ /* Overflowing while handling an overflow.
+ * Use the prebuilt exception object. */
+ PyErr_SetObject(PyExc_RuntimeError, PyExc_RecursionErrorInst);
+ --tstate->recursion_depth;
+ return -1;
}
- return 0;
}
if (tstate->recursion_depth > recursion_limit) {
- --tstate->recursion_depth;
tstate->overflowed = 1;
PyErr_Format(PyExc_RuntimeError,
"maximum recursion depth exceeded%s",
where);
+ --tstate->recursion_depth;
return -1;
}
return 0;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld cbc36f91f3f7