summaryrefslogtreecommitdiff
path: root/Python/compile.c
diff options
context:
space:
mode:
authorGiampaolo Rodola <g.rodola@gmail.com>2019-03-28 15:23:28 +0100
committerGiampaolo Rodola <g.rodola@gmail.com>2019-03-28 15:23:28 +0100
commite19b28f2bd89c047b12f6a8ffb1fe793834700d3 (patch)
tree8261b98b29eedb8ce67df4d571e8ba9b948d17ab /Python/compile.c
parentf7868847da9f84cb68605b4b94d8fcc205e0766e (diff)
parent3eca28c61363a03b81b9fb12775490d6e42d8ecf (diff)
downloadcpython-git-e19b28f2bd89c047b12f6a8ffb1fe793834700d3.tar.gz
Merge branch 'master' into bind-socket
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;
}