mirror of
https://github.com/python/cpython.git
synced 2025-08-28 20:56:54 +00:00
SF bug 567538: Generator can crash the interpreter (Finn Bock).
This was a simple typo. Strange that the compiler didn't catch it! Instead of WHY_CONTINUE, two tests used CONTINUE_LOOP, which isn't a why_code at all, but an opcode; but even though 'why' is declared as an enum, comparing it to an int is apparently not even worth a warning -- not in gcc, and not in VC++. :-( Will fix in 2.2 too.
This commit is contained in:
parent
969de458aa
commit
c5fe5eb8d2
3 changed files with 25 additions and 2 deletions
|
@ -1543,7 +1543,7 @@ eval_frame(PyFrameObject *f)
|
|||
why = (enum why_code) PyInt_AsLong(v);
|
||||
if (why == WHY_RETURN ||
|
||||
why == WHY_YIELD ||
|
||||
why == CONTINUE_LOOP)
|
||||
why == WHY_CONTINUE)
|
||||
retval = POP();
|
||||
}
|
||||
else if (PyString_Check(v) || PyClass_Check(v)) {
|
||||
|
@ -2293,7 +2293,7 @@ eval_frame(PyFrameObject *f)
|
|||
}
|
||||
else {
|
||||
if (why == WHY_RETURN ||
|
||||
why == CONTINUE_LOOP)
|
||||
why == WHY_CONTINUE)
|
||||
PUSH(retval);
|
||||
v = PyInt_FromLong((long)why);
|
||||
PUSH(v);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue