mirror of
https://github.com/python/cpython.git
synced 2025-11-01 18:51:43 +00:00
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.
This commit is contained in:
parent
5a9fb3c415
commit
664b43b3f4
1 changed files with 3 additions and 6 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue