summaryrefslogtreecommitdiff
path: root/Python/specialize.c
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2021-11-23 09:53:24 +0000
committerGitHub <noreply@github.com>2021-11-23 09:53:24 +0000
commit135cabd328504e1648d17242b42b675cdbd0193b (patch)
tree4efa5418b1816ba02c206678ecfa4e2d8e8d8f14 /Python/specialize.c
parentd82f2caf942fa8b94e797a2f116ee54ec303c2df (diff)
downloadcpython-git-135cabd328504e1648d17242b42b675cdbd0193b.tar.gz
bpo-44525: Copy free variables in bytecode to allow calls to inner functions to be specialized (GH-29595)
* Make internal APIs that take PyFrameConstructor take a PyFunctionObject instead. * Add reference to function to frame, borrow references to builtins and globals. * Add COPY_FREE_VARS instruction to allow specialization of calls to inner functions.
Diffstat (limited to 'Python/specialize.c')
-rw-r--r--Python/specialize.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/Python/specialize.c b/Python/specialize.c
index 130da008ad..f5f12139df 100644
--- a/Python/specialize.c
+++ b/Python/specialize.c
@@ -479,7 +479,7 @@ initial_counter_value(void) {
#define SPEC_FAIL_WRONG_NUMBER_ARGUMENTS 9
#define SPEC_FAIL_CO_NOT_OPTIMIZED 10
/* SPEC_FAIL_METHOD defined as 11 above */
-#define SPEC_FAIL_FREE_VARS 12
+
#define SPEC_FAIL_PYCFUNCTION 13
#define SPEC_FAIL_PYCFUNCTION_WITH_KEYWORDS 14
#define SPEC_FAIL_PYCFUNCTION_FAST_WITH_KEYWORDS 15
@@ -1158,9 +1158,6 @@ function_kind(PyCodeObject *code) {
if ((flags & CO_OPTIMIZED) == 0) {
return SPEC_FAIL_CO_NOT_OPTIMIZED;
}
- if (code->co_nfreevars) {
- return SPEC_FAIL_FREE_VARS;
- }
return SIMPLE_FUNCTION;
}