aboutsummaryrefslogtreecommitdiff
path: root/Python
diff options
context:
space:
mode:
authorBrandt Bucher <brandtbucher@microsoft.com>2023-05-12 16:03:47 -0700
committerGitHub <noreply@github.com>2023-05-12 23:03:47 +0000
commitfbb6def08a7ce7d21653e15ccbc4017b4eb2e795 (patch)
tree85c86ae7bbc4afc2e3675d71b025e3f4246f6c8f /Python
parent4ade7c33696b6a2a2e07295366ae0c29c31bb050 (diff)
downloadcpython3-fbb6def08a7ce7d21653e15ccbc4017b4eb2e795.tar.gz
[3.11] GH-104405: Add missing PEP 523 checks (GH-104441)
Diffstat (limited to 'Python')
-rw-r--r--Python/ceval.c1
-rw-r--r--Python/specialize.c4
2 files changed, 5 insertions, 0 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index 72f9c8375d..47df353197 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -2233,6 +2233,7 @@ handle_eval_breaker:
}
TARGET(BINARY_SUBSCR_GETITEM) {
+ DEOPT_IF(tstate->interp->eval_frame, BINARY_SUBSCR);
PyObject *sub = TOP();
PyObject *container = SECOND();
_PyBinarySubscrCache *cache = (_PyBinarySubscrCache *)next_instr;
diff --git a/Python/specialize.c b/Python/specialize.c
index 08ce2f5caa..9d182fd31b 100644
--- a/Python/specialize.c
+++ b/Python/specialize.c
@@ -1238,6 +1238,10 @@ _Py_Specialize_BinarySubscr(
SPECIALIZATION_FAIL(BINARY_SUBSCR, SPEC_FAIL_OUT_OF_VERSIONS);
goto fail;
}
+ if (_PyInterpreterState_GET()->eval_frame) {
+ SPECIALIZATION_FAIL(BINARY_SUBSCR, SPEC_FAIL_OTHER);
+ goto fail;
+ }
cache->func_version = version;
((PyHeapTypeObject *)container_type)->_spec_cache.getitem = descriptor;
_Py_SET_OPCODE(*instr, BINARY_SUBSCR_GETITEM);