mirror of
https://github.com/python/cpython.git
synced 2025-12-31 04:23:37 +00:00
gh-134584: Eliminate redundant refcounting from _STORE_SUBSCR_DICT (GH-142712)
Co-authored-by: Ken Jin <kenjin4096@gmail.com>
This commit is contained in:
parent
872ab51f32
commit
abaaeee6a0
9 changed files with 74 additions and 23 deletions
|
|
@ -1158,9 +1158,9 @@ dummy_func(
|
|||
}
|
||||
|
||||
macro(STORE_SUBSCR_DICT) =
|
||||
_GUARD_NOS_DICT + unused/1 + _STORE_SUBSCR_DICT;
|
||||
_GUARD_NOS_DICT + unused/1 + _STORE_SUBSCR_DICT + POP_TOP;
|
||||
|
||||
op(_STORE_SUBSCR_DICT, (value, dict_st, sub -- )) {
|
||||
op(_STORE_SUBSCR_DICT, (value, dict_st, sub -- st)) {
|
||||
PyObject *dict = PyStackRef_AsPyObjectBorrow(dict_st);
|
||||
|
||||
assert(PyDict_CheckExact(dict));
|
||||
|
|
@ -1168,8 +1168,12 @@ dummy_func(
|
|||
int err = _PyDict_SetItem_Take2((PyDictObject *)dict,
|
||||
PyStackRef_AsPyObjectSteal(sub),
|
||||
PyStackRef_AsPyObjectSteal(value));
|
||||
PyStackRef_CLOSE(dict_st);
|
||||
ERROR_IF(err);
|
||||
if (err) {
|
||||
PyStackRef_CLOSE(dict_st);
|
||||
ERROR_IF(1);
|
||||
}
|
||||
DEAD(dict_st);
|
||||
st = dict_st;
|
||||
}
|
||||
|
||||
inst(DELETE_SUBSCR, (container, sub --)) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue