Issue1595
Created on 2007-12-11 21:40 by amaury.forgeotdarc, last changed 2008-02-12 19:30 by loewis.
|
msg58468 - (view) |
Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) |
Date: 2007-12-11 21:40 |
|
In file ceval.h, the macro Py_LeaveRecursiveCall is defined like this:
#define Py_LeaveRecursiveCall() \
do{ if((--PyThreadState_GET()->recursion_depth) < \
_Py_CheckRecursionLimit - 50); \
PyThreadState_GET()->overflowed = 0; \
} while(0)
The semicolon on the third line seems very suspicious to me: the if()
statement has no side effect, and "overflowed" is always reset to zero.
I don't really understand the consequences, though. The variable seems
to be used as an additional protection against C code that does not
correctly unwind when the recursion limit is hit.
|
|
msg58471 - (view) |
Author: Martin v. Löwis (loewis) |
Date: 2007-12-11 22:07 |
|
I think you are right - that's a bug. As a consequence, overflowed would
be cleared less often than it is now, which in turn may cause a fatal
abort in case it fails to recover from a stack overflow (i.e. if it
consumes another 50 stack frames, instead of unwinding).
This entire machinery is there to guard against hard-to-analyze crashes
resulting from stack overflows, in particular when a dictionary lookup
happened to cause a stack overflow. The overflow would raise the Python
exception, which would then be cleared in the dictionary lookup, as if
nothing happened.
|
|
msg62330 - (view) |
Author: Martin v. Löwis (loewis) |
Date: 2008-02-12 19:30 |
|
Thanks again for pointing that out. Fixed in r60750.
|
|
| Date |
User |
Action |
Args |
| 2008-02-12 19:30:56 | loewis | set | status: open -> closed resolution: fixed messages:
+ msg62330 |
| 2008-01-29 17:21:01 | orivej | set | nosy:
+ orivej |
| 2008-01-06 22:29:44 | admin | set | keywords:
- py3k versions:
Python 3.0 |
| 2008-01-05 22:12:41 | christian.heimes | set | priority: high |
| 2007-12-11 22:07:44 | loewis | set | messages:
+ msg58471 |
| 2007-12-11 21:40:48 | amaury.forgeotdarc | create | |
|