summaryrefslogtreecommitdiff
path: root/Python/compile.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/compile.c')
-rw-r--r--Python/compile.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/Python/compile.c b/Python/compile.c
index c26210675d..a992e4b465 100644
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -330,6 +330,7 @@ PyAST_CompileObject(mod_ty mod, PyObject *filename, PyCompilerFlags *flags,
goto finally;
if (!flags) {
local_flags.cf_flags = 0;
+ local_flags.cf_feature_version = PY_MINOR_VERSION;
flags = &local_flags;
}
merged = c.c_future->ff_features | flags->cf_flags;
@@ -1209,7 +1210,7 @@ merge_consts_recursive(struct compiler *c, PyObject *o)
PyObject *t = PyDict_SetDefault(c->c_const_cache, key, key);
if (t != key) {
// o is registered in c_const_cache. Just use it.
- Py_INCREF(t);
+ Py_XINCREF(t);
Py_DECREF(key);
return t;
}
@@ -3878,6 +3879,7 @@ check_index(struct compiler *c, expr_ty e, slice_ty s)
}
}
+// Return 1 if the method call was optimized, -1 if not, and 0 on error.
static int
maybe_optimize_method_call(struct compiler *c, expr_ty e)
{
@@ -3911,8 +3913,10 @@ maybe_optimize_method_call(struct compiler *c, expr_ty e)
static int
compiler_call(struct compiler *c, expr_ty e)
{
- if (maybe_optimize_method_call(c, e) > 0)
- return 1;
+ int ret = maybe_optimize_method_call(c, e);
+ if (ret >= 0) {
+ return ret;
+ }
if (!check_caller(c, e->v.Call.func)) {
return 0;
}