aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Python/compile.c
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2023-06-13 09:51:05 +0100
committerGitHub <noreply@github.com>2023-06-13 09:51:05 +0100
commit09ffa69e2e84950751739ab500f820725e00a3dd (patch)
treeaec7308298f61cd813a9baa1d81e2c1348160e64 /Python/compile.c
parent217589d4f3246d67c6ef0eb0be2b1c33987cf260 (diff)
downloadcpython-09ffa69e2e84950751739ab500f820725e00a3dd.tar.gz
cpython-09ffa69e2e84950751739ab500f820725e00a3dd.zip
GH-105678: Split MAKE_FUNCTION into MAKE_FUNCTION and SET_FUNCTION_ATTRIBUTE (GH-105680)
Diffstat (limited to 'Python/compile.c')
-rw-r--r--Python/compile.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/Python/compile.c b/Python/compile.c
index 68b0466d958..589d92f5a7e 100644
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -1823,7 +1823,21 @@ compiler_make_closure(struct compiler *c, location loc,
ADDOP_I(c, loc, BUILD_TUPLE, co->co_nfreevars);
}
ADDOP_LOAD_CONST(c, loc, (PyObject*)co);
- ADDOP_I(c, loc, MAKE_FUNCTION, flags);
+
+ ADDOP(c, loc, MAKE_FUNCTION);
+
+ if (flags & MAKE_FUNCTION_CLOSURE) {
+ ADDOP_I(c, loc, SET_FUNCTION_ATTRIBUTE, MAKE_FUNCTION_CLOSURE);
+ }
+ if (flags & MAKE_FUNCTION_ANNOTATIONS) {
+ ADDOP_I(c, loc, SET_FUNCTION_ATTRIBUTE, MAKE_FUNCTION_ANNOTATIONS);
+ }
+ if (flags & MAKE_FUNCTION_KWDEFAULTS) {
+ ADDOP_I(c, loc, SET_FUNCTION_ATTRIBUTE, MAKE_FUNCTION_KWDEFAULTS);
+ }
+ if (flags & MAKE_FUNCTION_DEFAULTS) {
+ ADDOP_I(c, loc, SET_FUNCTION_ATTRIBUTE, MAKE_FUNCTION_DEFAULTS);
+ }
return SUCCESS;
}