Skip to content
Prev Previous commit
Next Next commit
Do not bother inc/dec-refing Py_EMPTY_KEYS.
  • Loading branch information
ericsnowcurrently committed May 9, 2023
commit bdbce5f693ffdb40e5887e600a1422a98b89ce69
4 changes: 2 additions & 2 deletions Objects/dictobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -846,7 +846,7 @@ PyObject *
PyDict_New(void)
{
PyInterpreterState *interp = _PyInterpreterState_GET();
dictkeys_incref(Py_EMPTY_KEYS);
/* We don't incref Py_EMPTY_KEYS here because it is immortal. */
return new_dict(interp, Py_EMPTY_KEYS, NULL, 0, 0);
}

Expand Down Expand Up @@ -1344,7 +1344,7 @@ insert_to_emptydict(PyInterpreterState *interp, PyDictObject *mp,
Py_DECREF(value);
return -1;
}
dictkeys_decref(interp, Py_EMPTY_KEYS);
/* We don't decref Py_EMPTY_KEYS here because it is immortal. */
mp->ma_keys = newkeys;
mp->ma_values = NULL;

Expand Down