From: Armin Rigo Date: Fri, 7 Jan 2005 18:10:51 +0000 (+0000) Subject: Re-running python with/without the -Qnew flag uses incorrectly optimized X-Git-Tag: v2.5a0~2164 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=664b43b3f4cbb7a63d5d67117e1d040a286af371;p=thirdparty%2FPython%2Fcpython.git Re-running python with/without the -Qnew flag uses incorrectly optimized bytecodes from the previously saved .pyc files. Fixed by disabling the static optimization of BINARY_DIVIDE between two constants. --- diff --git a/Python/compile.c b/Python/compile.c index 15c843614977..545042f87c0a 100644 --- a/Python/compile.c +++ b/Python/compile.c @@ -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;