]> granicus.if.org Git - python/commitdiff
optimize_code(): Repaired gross error in new special-casing for None.
authorTim Peters <tim.peters@gmail.com>
Sat, 17 Jul 2004 05:00:52 +0000 (05:00 +0000)
committerTim Peters <tim.peters@gmail.com>
Sat, 17 Jul 2004 05:00:52 +0000 (05:00 +0000)
The preceding case statement was missing a terminating "break" stmt,
so fell into the new code by mistake.  This caused uncaught out-of-bounds
accesses to the "names" tuple, leading to a variety of insane behaviors.

Python/compile.c

index ca8dd266ffe3cc6f49339806c6f7a843a08bee2c..5549e9f75b6aa5217e1742d334873b1815dbf632 100644 (file)
@@ -419,7 +419,8 @@ optimize_code(PyObject *code, PyObject* consts, PyObject *names)
                         continue;
                        SETARG(codestr, i, (j^1));
                        codestr[i+3] = NOP;
-               
+                       break;
+
                /* Replace LOAD_GLOBAL/LOAD_NAME None with LOAD_CONST None */
                case LOAD_NAME:
                case LOAD_GLOBAL: