GH-134584: Remove redundant refcount for BINARY_OP_SUBSCR_STR_INT (#142844)

This commit is contained in:
Savannah Ostrowski 2025-12-18 13:29:54 -08:00 committed by GitHub
parent e79c39101a
commit 1391ee664c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 74 additions and 31 deletions

View file

@ -941,9 +941,9 @@ dummy_func(
}
macro(BINARY_OP_SUBSCR_STR_INT) =
_GUARD_TOS_INT + _GUARD_NOS_UNICODE + unused/5 + _BINARY_OP_SUBSCR_STR_INT;
_GUARD_TOS_INT + _GUARD_NOS_UNICODE + unused/5 + _BINARY_OP_SUBSCR_STR_INT + _POP_TOP_INT + POP_TOP;
op(_BINARY_OP_SUBSCR_STR_INT, (str_st, sub_st -- res)) {
op(_BINARY_OP_SUBSCR_STR_INT, (str_st, sub_st -- res, s, i)) {
PyObject *sub = PyStackRef_AsPyObjectBorrow(sub_st);
PyObject *str = PyStackRef_AsPyObjectBorrow(str_st);
@ -958,9 +958,9 @@ dummy_func(
assert(c < 128);
STAT_INC(BINARY_OP, hit);
PyObject *res_o = (PyObject*)&_Py_SINGLETON(strings).ascii[c];
PyStackRef_CLOSE_SPECIALIZED(sub_st, _PyLong_ExactDealloc);
DEAD(sub_st);
PyStackRef_CLOSE(str_st);
INPUTS_DEAD();
s = str_st;
i = sub_st;
res = PyStackRef_FromPyObjectBorrow(res_o);
}