summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
Diffstat (limited to 'Python')
-rw-r--r--Python/ceval.c25
-rw-r--r--Python/pythonrun.c4
2 files changed, 18 insertions, 11 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index 5358517..76424e1 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -903,9 +903,22 @@ eval_frame(PyFrameObject *f)
break;
case BINARY_DIVIDE:
+ if (!_Py_QnewFlag) {
+ w = POP();
+ v = POP();
+ x = PyNumber_Divide(v, w);
+ Py_DECREF(v);
+ Py_DECREF(w);
+ PUSH(x);
+ if (x != NULL) continue;
+ break;
+ }
+ /* -Qnew is in effect: fall through to
+ BINARY_TRUE_DIVIDE */
+ case BINARY_TRUE_DIVIDE:
w = POP();
v = POP();
- x = PyNumber_Divide(v, w);
+ x = PyNumber_TrueDivide(v, w);
Py_DECREF(v);
Py_DECREF(w);
PUSH(x);
@@ -922,16 +935,6 @@ eval_frame(PyFrameObject *f)
if (x != NULL) continue;
break;
- case BINARY_TRUE_DIVIDE:
- w = POP();
- v = POP();
- x = PyNumber_TrueDivide(v, w);
- Py_DECREF(v);
- Py_DECREF(w);
- PUSH(x);
- if (x != NULL) continue;
- break;
-
case BINARY_MODULO:
w = POP();
v = POP();
diff --git a/Python/pythonrun.c b/Python/pythonrun.c
index 628058b..a8ad845 100644
--- a/Python/pythonrun.c
+++ b/Python/pythonrun.c
@@ -64,6 +64,10 @@ int Py_UseClassExceptionsFlag = 1; /* Needed by bltinmodule.c: deprecated */
int Py_FrozenFlag; /* Needed by getpath.c */
int Py_UnicodeFlag = 0; /* Needed by compile.c */
int Py_IgnoreEnvironmentFlag; /* e.g. PYTHONPATH, PYTHONHOME */
+/* _XXX Py_QnewFlag should go away in 2.3. It's true iff -Qnew is passed,
+ on the command line, and is used in 2.2 by ceval.c to make all "/" divisions
+ true divisions (which they will be in 2.3). */
+int _Py_QnewFlag = 0;
static int initialized = 0;