summaryrefslogtreecommitdiffstats
path: root/Python/specialize.c
diff options
context:
space:
mode:
authorMark Shannon <mark@hotpy.org>2022-05-04 15:31:21 (GMT)
committerGitHub <noreply@github.com>2022-05-04 15:31:21 (GMT)
commitf8a2fab212c4e9ea92a5b667560449904c4cf7af (patch)
treedc6c40594f776bd7d262a1b915661c253acc92d3 /Python/specialize.c
parent9d20e1af409c22537f096206edd330f16ab8f1f3 (diff)
downloadcpython-f8a2fab212c4e9ea92a5b667560449904c4cf7af.zip
cpython-f8a2fab212c4e9ea92a5b667560449904c4cf7af.tar.gz
cpython-f8a2fab212c4e9ea92a5b667560449904c4cf7af.tar.bz2
GH-92239: Make sure that PEP 523 is supported, even when specializing first. (GH-92245)
Diffstat (limited to 'Python/specialize.c')
-rw-r--r--Python/specialize.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/Python/specialize.c b/Python/specialize.c
index 12871ce..fa42993 100644
--- a/Python/specialize.c
+++ b/Python/specialize.c
@@ -440,6 +440,7 @@ initial_counter_value(void) {
#define SPEC_FAIL_CALL_METHOD_WRAPPER 26
#define SPEC_FAIL_CALL_OPERATOR_WRAPPER 27
#define SPEC_FAIL_CALL_PYFUNCTION 28
+#define SPEC_FAIL_CALL_PEP_523 29
/* COMPARE_OP */
#define SPEC_FAIL_COMPARE_OP_DIFFERENT_TYPES 12
@@ -1471,6 +1472,11 @@ specialize_py_call(PyFunctionObject *func, _Py_CODEUNIT *instr, int nargs,
assert(_Py_OPCODE(*instr) == CALL_ADAPTIVE);
PyCodeObject *code = (PyCodeObject *)func->func_code;
int kind = function_kind(code);
+ /* Don't specialize if PEP 523 is active */
+ if (_PyInterpreterState_GET()->eval_frame) {
+ SPECIALIZATION_FAIL(CALL, SPEC_FAIL_CALL_PEP_523);
+ return -1;
+ }
if (kwnames) {
SPECIALIZATION_FAIL(CALL, SPEC_FAIL_CALL_KWNAMES);
return -1;