https://github.com/python/cpython/commit/f7567b44a1eeb471fa239cc817eaa87099f88c18
commit: f7567b44a1eeb471fa239cc817eaa87099f88c18
branch: 3.14
author: AN Long <[email protected]>
committer: Fidget-Spinner <[email protected]>
date: 2026-01-20T18:05:56Z
summary:
[3.14] gh-144012: Check null binary op extend (GH-144014) (GH-144038)
(cherry picked from commit 54bedcf714160c3ecff3103a53f6291a7e1efd27)
files:
A
Misc/NEWS.d/next/Core_and_Builtins/2026-01-19-02-33-45.gh-issue-144012.wVEEWs.rst
M Include/internal/pycore_opcode_metadata.h
M Include/internal/pycore_uop_metadata.h
M Python/bytecodes.c
M Python/executor_cases.c.h
M Python/generated_cases.c.h
diff --git a/Include/internal/pycore_opcode_metadata.h
b/Include/internal/pycore_opcode_metadata.h
index 947e0e58868e1d..ccd10e90f0c0a3 100644
--- a/Include/internal/pycore_opcode_metadata.h
+++ b/Include/internal/pycore_opcode_metadata.h
@@ -1082,7 +1082,7 @@ const struct opcode_metadata
_PyOpcode_opcode_metadata[267] = {
[BINARY_OP_ADD_FLOAT] = { true, INSTR_FMT_IXC0000, HAS_EXIT_FLAG |
HAS_ERROR_FLAG },
[BINARY_OP_ADD_INT] = { true, INSTR_FMT_IXC0000, HAS_EXIT_FLAG |
HAS_ERROR_FLAG | HAS_ESCAPES_FLAG },
[BINARY_OP_ADD_UNICODE] = { true, INSTR_FMT_IXC0000, HAS_EXIT_FLAG |
HAS_ERROR_FLAG },
- [BINARY_OP_EXTEND] = { true, INSTR_FMT_IXC0000, HAS_DEOPT_FLAG |
HAS_ESCAPES_FLAG },
+ [BINARY_OP_EXTEND] = { true, INSTR_FMT_IXC0000, HAS_DEOPT_FLAG |
HAS_ERROR_FLAG | HAS_ESCAPES_FLAG },
[BINARY_OP_INPLACE_ADD_UNICODE] = { true, INSTR_FMT_IXC0000,
HAS_LOCAL_FLAG | HAS_DEOPT_FLAG | HAS_EXIT_FLAG | HAS_ERROR_FLAG |
HAS_ESCAPES_FLAG },
[BINARY_OP_MULTIPLY_FLOAT] = { true, INSTR_FMT_IXC0000, HAS_EXIT_FLAG |
HAS_ERROR_FLAG },
[BINARY_OP_MULTIPLY_INT] = { true, INSTR_FMT_IXC0000, HAS_EXIT_FLAG |
HAS_ERROR_FLAG | HAS_ESCAPES_FLAG },
diff --git a/Include/internal/pycore_uop_metadata.h
b/Include/internal/pycore_uop_metadata.h
index 912b1e56692e1c..2166a6900f120a 100644
--- a/Include/internal/pycore_uop_metadata.h
+++ b/Include/internal/pycore_uop_metadata.h
@@ -95,7 +95,7 @@ const uint16_t _PyUop_Flags[MAX_UOP_ID+1] = {
[_BINARY_OP_ADD_UNICODE] = HAS_ERROR_FLAG | HAS_PURE_FLAG,
[_BINARY_OP_INPLACE_ADD_UNICODE] = HAS_LOCAL_FLAG | HAS_DEOPT_FLAG |
HAS_ERROR_FLAG | HAS_ESCAPES_FLAG,
[_GUARD_BINARY_OP_EXTEND] = HAS_DEOPT_FLAG | HAS_ESCAPES_FLAG,
- [_BINARY_OP_EXTEND] = HAS_ESCAPES_FLAG | HAS_PURE_FLAG,
+ [_BINARY_OP_EXTEND] = HAS_ERROR_FLAG | HAS_ESCAPES_FLAG | HAS_PURE_FLAG,
[_BINARY_SLICE] = HAS_ERROR_FLAG | HAS_ESCAPES_FLAG,
[_STORE_SLICE] = HAS_ERROR_FLAG | HAS_ESCAPES_FLAG,
[_BINARY_OP_SUBSCR_LIST_INT] = HAS_DEOPT_FLAG | HAS_ESCAPES_FLAG,
diff --git
a/Misc/NEWS.d/next/Core_and_Builtins/2026-01-19-02-33-45.gh-issue-144012.wVEEWs.rst
b/Misc/NEWS.d/next/Core_and_Builtins/2026-01-19-02-33-45.gh-issue-144012.wVEEWs.rst
new file mode 100644
index 00000000000000..716a6e149cf885
--- /dev/null
+++
b/Misc/NEWS.d/next/Core_and_Builtins/2026-01-19-02-33-45.gh-issue-144012.wVEEWs.rst
@@ -0,0 +1 @@
+Check if the result is ``NULL`` in ``BINARY_OP_EXTENT`` opcode.
diff --git a/Python/bytecodes.c b/Python/bytecodes.c
index 70f8ac3cff84f9..78325111374a3f 100644
--- a/Python/bytecodes.c
+++ b/Python/bytecodes.c
@@ -824,6 +824,7 @@ dummy_func(
PyObject *res_o = d->action(left_o, right_o);
DECREF_INPUTS();
+ ERROR_IF(res_o == NULL);
res = PyStackRef_FromPyObjectSteal(res_o);
}
diff --git a/Python/executor_cases.c.h b/Python/executor_cases.c.h
index e3f4e5bdb65fd5..9dcd9afe884153 100644
--- a/Python/executor_cases.c.h
+++ b/Python/executor_cases.c.h
@@ -1193,6 +1193,9 @@
stack_pointer = _PyFrame_GetStackPointer(frame);
stack_pointer += -2;
assert(WITHIN_STACK_BOUNDS());
+ if (res_o == NULL) {
+ JUMP_TO_ERROR();
+ }
res = PyStackRef_FromPyObjectSteal(res_o);
stack_pointer[0] = res;
stack_pointer += 1;
diff --git a/Python/generated_cases.c.h b/Python/generated_cases.c.h
index f2b99365772f4d..20b5c4b3f497a9 100644
--- a/Python/generated_cases.c.h
+++ b/Python/generated_cases.c.h
@@ -315,6 +315,9 @@
stack_pointer = _PyFrame_GetStackPointer(frame);
stack_pointer += -2;
assert(WITHIN_STACK_BOUNDS());
+ if (res_o == NULL) {
+ JUMP_TO_LABEL(error);
+ }
res = PyStackRef_FromPyObjectSteal(res_o);
}
stack_pointer[0] = res;
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]