]> granicus.if.org Git - python/commitdiff
Get rid of last vestiges of BINARY_DIVIDE.
authorNeal Norwitz <nnorwitz@gmail.com>
Thu, 16 Mar 2006 06:02:10 +0000 (06:02 +0000)
committerNeal Norwitz <nnorwitz@gmail.com>
Thu, 16 Mar 2006 06:02:10 +0000 (06:02 +0000)
Doc/lib/libdis.tex
Include/opcode.h
Lib/compiler/pycodegen.py
Lib/opcode.py
Python/ceval.c
Python/compile.c

index 67691b709b1683c02f606acd1650e775878a51b4..a5b2c2c54a24da3bf29f4b24617da361c1b39930 100644 (file)
@@ -189,11 +189,6 @@ Implements \code{TOS = TOS1 ** TOS}.
 Implements \code{TOS = TOS1 * TOS}.
 \end{opcodedesc}
 
-\begin{opcodedesc}{BINARY_DIVIDE}{}
-Implements \code{TOS = TOS1 / TOS} when
-\code{from __future__ import division} is not in effect.
-\end{opcodedesc}
-
 \begin{opcodedesc}{BINARY_FLOOR_DIVIDE}{}
 Implements \code{TOS = TOS1 // TOS}.
 \end{opcodedesc}
index d8cb2cd4809068ba67898edc675feb09f7e58feb..d05588a8d34b4b4adf22a3bc34173c8ebba45b48 100644 (file)
@@ -26,7 +26,7 @@ extern "C" {
 #define BINARY_POWER   19
 
 #define BINARY_MULTIPLY        20
-#define BINARY_DIVIDE  21
+
 #define BINARY_MODULO  22
 #define BINARY_ADD     23
 #define BINARY_SUBTRACT        24
index f25b3fbf5f830671d2b90d0cedafa514321d3b8f..e34120ef5d9c3a20cc109da5bf0e4d084027322f 100644 (file)
@@ -206,14 +206,12 @@ class CodeGenerator:
         self.setups = misc.Stack()
         self.last_lineno = None
         self._setupGraphDelegation()
-        self._div_op = "BINARY_DIVIDE"
 
         # XXX set flags based on future features
         futures = self.get_module().futures
         for feature in futures:
             if feature == "division":
                 self.graph.setFlag(CO_FUTURE_DIVISION)
-                self._div_op = "BINARY_TRUE_DIVIDE"
             elif feature == "absolute_import":
                 self.graph.setFlag(CO_FUTURE_ABSIMPORT)
             elif feature == "with_statement":
@@ -1177,7 +1175,7 @@ class CodeGenerator:
         return self.binaryOp(node, 'BINARY_MULTIPLY')
 
     def visitDiv(self, node):
-        return self.binaryOp(node, self._div_op)
+        return self.binaryOp(node, 'BINARY_TRUE_DIVIDE')
 
     def visitFloorDiv(self, node):
         return self.binaryOp(node, 'BINARY_FLOOR_DIVIDE')
index 095ca42ec01a899e0870ec467a567548279b93ba..2b9212f75b42e55dde15ced6c9a97af5c303ee89 100644 (file)
@@ -61,7 +61,7 @@ def_op('UNARY_INVERT', 15)
 def_op('LIST_APPEND', 18)
 def_op('BINARY_POWER', 19)
 def_op('BINARY_MULTIPLY', 20)
-def_op('BINARY_DIVIDE', 21)
+
 def_op('BINARY_MODULO', 22)
 def_op('BINARY_ADD', 23)
 def_op('BINARY_SUBTRACT', 24)
index c854fcfe51c9abafcc4783fa1edb8629fb8c93a2..1a3561016c3732e15c40826d93f7ec6b2ff2d302 100644 (file)
@@ -1073,19 +1073,6 @@ PyEval_EvalFrameEx(PyFrameObject *f, int throw)
                        if (x != NULL) continue;
                        break;
 
-               case BINARY_DIVIDE:
-                       if (!_Py_QnewFlag) {
-                               w = POP();
-                               v = TOP();
-                               x = PyNumber_Divide(v, w);
-                               Py_DECREF(v);
-                               Py_DECREF(w);
-                               SET_TOP(x);
-                               if (x != NULL) continue;
-                               break;
-                       }
-                       /* -Qnew is in effect:  fall through to
-                          BINARY_TRUE_DIVIDE */
                case BINARY_TRUE_DIVIDE:
                        w = POP();
                        v = TOP();
index cfc6ef199e60b59088d4a24097bdcbceeda4fb49..9ce2bf795fc10397c36cc296d6c7a0d13350ceaf 100644 (file)
@@ -479,11 +479,6 @@ fold_binops_on_constants(unsigned char *codestr, PyObject *consts)
                case BINARY_MULTIPLY:
                        newconst = PyNumber_Multiply(v, w);
                        break;
-               case BINARY_DIVIDE:
-                       /* Cannot fold this operation statically since
-                           the result can depend on the run-time presence
-                           of the -Qnew flag */
-                       return 0;
                case BINARY_TRUE_DIVIDE:
                        newconst = PyNumber_TrueDivide(v, w);
                        break;
@@ -1302,7 +1297,6 @@ opcode_stack_effect(int opcode, int oparg)
 
                case BINARY_POWER:
                case BINARY_MULTIPLY:
-               case BINARY_DIVIDE:
                case BINARY_MODULO:
                case BINARY_ADD:
                case BINARY_SUBTRACT: