summaryrefslogtreecommitdiffstats
path: root/Python/compile.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/compile.c')
-rw-r--r--Python/compile.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/Python/compile.c b/Python/compile.c
index 49e57d1..01e961b 100644
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -385,6 +385,9 @@ PyCode_New(int argcount, int nlocals, int stacksize, int flags,
co->co_firstlineno = firstlineno;
Py_INCREF(lnotab);
co->co_lnotab = lnotab;
+ if (PyTuple_GET_SIZE(freevars) == 0 &&
+ PyTuple_GET_SIZE(cellvars) == 0)
+ co->co_flags |= CO_NOFREE;
}
return co;
}