]> granicus.if.org Git - python/commitdiff
The opcode FOR_LOOP no longer exists.
authorGuido van Rossum <guido@python.org>
Thu, 13 Jun 2002 17:59:51 +0000 (17:59 +0000)
committerGuido van Rossum <guido@python.org>
Thu, 13 Jun 2002 17:59:51 +0000 (17:59 +0000)
Doc/lib/libdis.tex
Include/opcode.h
Lib/dis.py
Python/ceval.c

index 38b34646a10479f3d5f5dbc9fbb3f90ff7643353..90f83a3624f9615e3103ff3318f143f1ebdd504e 100644 (file)
@@ -556,13 +556,9 @@ it).  If the iterator indicates it is exhausted  \code{TOS} is
 popped, and the byte code counter is incremented by \var{delta}.
 \end{opcodedesc}
 
-\begin{opcodedesc}{FOR_LOOP}{delta}
-This opcode is obsolete.
-%Iterate over a sequence.  TOS is the current index, TOS1 the sequence.
-%First, the next element is computed.  If the sequence is exhausted,
-%increment byte code counter by \var{delta}.  Otherwise, push the
-%sequence, the incremented counter, and the current item onto the stack.
-\end{opcodedesc}
+%\begin{opcodedesc}{FOR_LOOP}{delta}
+%This opcode is obsolete.
+%\end{opcodedesc}
 
 %\begin{opcodedesc}{LOAD_LOCAL}{namei}
 %This opcode is obsolete.
index df086efc88ce37db66e73b9d62b13baa07e648da..2e2024618f7a22780ead344fc474371ab76c494d 100644 (file)
@@ -107,7 +107,6 @@ extern "C" {
 #define JUMP_IF_FALSE  111     /* "" */
 #define JUMP_IF_TRUE   112     /* "" */
 #define JUMP_ABSOLUTE  113     /* Target byte offset from beginning of code */
-#define FOR_LOOP       114     /* Number of bytes to skip */
 
 #define LOAD_GLOBAL    116     /* Index in name list */
 
index 15292228f7e399521ccbc8b48360a5c76c36fb17..267409443447bba479827e69595a5f28a89a1e2a 100644 (file)
@@ -262,7 +262,6 @@ jrel_op('JUMP_FORWARD', 110)    # Number of bytes to skip
 jrel_op('JUMP_IF_FALSE', 111)   # ""
 jrel_op('JUMP_IF_TRUE', 112)    # ""
 jabs_op('JUMP_ABSOLUTE', 113)   # Target byte offset from beginning of code
-jrel_op('FOR_LOOP', 114)        # Number of bytes to skip
 
 name_op('LOAD_GLOBAL', 116)     # Index in name list
 
index b9c0d5d3b32470e976f444aa18c0f20486c06e1e..12397b49efde0058cc8740fbfbe82cacdf2909f5 100644 (file)
@@ -1942,37 +1942,6 @@ eval_frame(PyFrameObject *f)
                        }
                        break;
 
-               case FOR_LOOP:
-                       /* for v in s: ...
-                          On entry: stack contains s, i.
-                          On exit: stack contains s, i+1, s[i];
-                          but if loop exhausted:
-                               s, i are popped, and we jump */
-                       w = POP(); /* Loop index */
-                       v = POP(); /* Sequence object */
-                       u = loop_subscript(v, w);
-                       if (u != NULL) {
-                               PUSH(v);
-                               x = PyInt_FromLong(PyInt_AsLong(w)+1);
-                               PUSH(x);
-                               Py_DECREF(w);
-                               PUSH(u);
-                               if (x != NULL) continue;
-                       }
-                       else {
-                               Py_DECREF(v);
-                               Py_DECREF(w);
-                               /* A NULL can mean "s exhausted"
-                                  but also an error: */
-                               if (PyErr_Occurred())
-                                       why = WHY_EXCEPTION;
-                               else {
-                                       JUMPBY(oparg);
-                                       continue;
-                               }
-                       }
-                       break;
-
                case SETUP_LOOP:
                case SETUP_EXCEPT:
                case SETUP_FINALLY: