summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2022-12-09 12:18:45 (GMT)
committerGitHub <noreply@github.com>2022-12-09 12:18:45 (GMT)
commitfb713b21833a17cba8022af0fa4c486512157d4b (patch)
tree2e75f1e59393160792f1097846a648ff7927de8d /Python
parent3c5355496b54fa0a4ea0e22344d008528e45682c (diff)
downloadcpython-fb713b21833a17cba8022af0fa4c486512157d4b.zip
cpython-fb713b21833a17cba8022af0fa4c486512157d4b.tar.gz
cpython-fb713b21833a17cba8022af0fa4c486512157d4b.tar.bz2
GH-98522: Add version number to code objects. (GH-98525)
* Add version number to code object for better versioning of functions. * Improves specialization for closures and list comprehensions.
Diffstat (limited to 'Python')
-rw-r--r--Python/bytecodes.c1
-rw-r--r--Python/generated_cases.c.h1
2 files changed, 2 insertions, 0 deletions
diff --git a/Python/bytecodes.c b/Python/bytecodes.c
index 5807bd5..c56f1d3 100644
--- a/Python/bytecodes.c
+++ b/Python/bytecodes.c
@@ -3452,6 +3452,7 @@ dummy_func(
func->func_defaults = POP();
}
+ func->func_version = ((PyCodeObject *)codeobj)->co_version;
PUSH((PyObject *)func);
}
diff --git a/Python/generated_cases.c.h b/Python/generated_cases.c.h
index 59e70b7..45382a4 100644
--- a/Python/generated_cases.c.h
+++ b/Python/generated_cases.c.h
@@ -3693,6 +3693,7 @@
func->func_defaults = POP();
}
+ func->func_version = ((PyCodeObject *)codeobj)->co_version;
PUSH((PyObject *)func);
DISPATCH();
}