summaryrefslogtreecommitdiffstats
path: root/Python/specialize.c
diff options
context:
space:
mode:
authorBrandt Bucher <brandtbucher@microsoft.com>2022-03-04 18:51:27 (GMT)
committerGitHub <noreply@github.com>2022-03-04 18:51:27 (GMT)
commitc4d2d57eefb1224a12e2e95e4508658dfbf6a7c9 (patch)
tree360ccc920f2e6afe516d038338f53f1e75d2136d /Python/specialize.c
parentcedd2473a9bebe07f3ced4f341cf58a2fef07b03 (diff)
downloadcpython-c4d2d57eefb1224a12e2e95e4508658dfbf6a7c9.zip
cpython-c4d2d57eefb1224a12e2e95e4508658dfbf6a7c9.tar.gz
cpython-c4d2d57eefb1224a12e2e95e4508658dfbf6a7c9.tar.bz2
bpo-46841: Fix BINARY_OP's handling of inline caches (GH-31671)
Diffstat (limited to 'Python/specialize.c')
-rw-r--r--Python/specialize.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/Python/specialize.c b/Python/specialize.c
index 912b9e2..6328f11 100644
--- a/Python/specialize.c
+++ b/Python/specialize.c
@@ -1951,7 +1951,8 @@ _Py_Specialize_BinaryOp(PyObject *lhs, PyObject *rhs, _Py_CODEUNIT *instr,
break;
}
if (PyUnicode_CheckExact(lhs)) {
- if (_Py_OPCODE(instr[1]) == STORE_FAST && Py_REFCNT(lhs) == 2) {
+ _Py_CODEUNIT next = instr[INLINE_CACHE_ENTRIES_BINARY_OP + 1];
+ if (_Py_OPCODE(next) == STORE_FAST && Py_REFCNT(lhs) == 2) {
*instr = _Py_MAKECODEUNIT(BINARY_OP_INPLACE_ADD_UNICODE,
oparg);
goto success;