]> granicus.if.org Git - python/commitdiff
Re-running python with/without the -Qnew flag uses incorrectly optimized
authorArmin Rigo <arigo@tunes.org>
Fri, 7 Jan 2005 18:10:51 +0000 (18:10 +0000)
committerArmin Rigo <arigo@tunes.org>
Fri, 7 Jan 2005 18:10:51 +0000 (18:10 +0000)
bytecodes from the previously saved .pyc files.  Fixed by disabling the static
optimization of BINARY_DIVIDE between two constants.

Python/compile.c

index 15c84361497702b989fc5c6a38572aa087a56316..545042f87c0ab22ae9d74dfe67b223e6e1dd677c 100644 (file)
@@ -468,12 +468,9 @@ fold_binops_on_constants(unsigned char *codestr, PyObject *consts)
                newconst = PyNumber_Multiply(v, w);
                break;
        case BINARY_DIVIDE:
-               if (!_Py_QnewFlag) {
-                       newconst = PyNumber_Divide(v, w);
-                       break;
-               }
-               /* -Qnew is in effect:  fall through to
-                  BINARY_TRUE_DIVIDE */
+               /* XXX care is needed to fold this operation statically:
+               the result might depend on the run-time presence of the -Qnew flag */
+               return 0;
        case BINARY_TRUE_DIVIDE:
                newconst = PyNumber_TrueDivide(v, w);
                break;