mirror of
https://github.com/python/cpython.git
synced 2025-10-10 00:43:41 +00:00
gh-116437: Use new C API PyDict_Pop() to simplify the code (GH-116438)
This commit is contained in:
parent
882fcede83
commit
72d3cc94cd
15 changed files with 116 additions and 119 deletions
|
@ -1262,13 +1262,9 @@ _localdummy_destroyed(PyObject *localweakref, PyObject *dummyweakref)
|
|||
/* If the thread-local object is still alive and not being cleared,
|
||||
remove the corresponding local dict */
|
||||
if (self->dummies != NULL) {
|
||||
PyObject *ldict;
|
||||
ldict = PyDict_GetItemWithError(self->dummies, dummyweakref);
|
||||
if (ldict != NULL) {
|
||||
PyDict_DelItem(self->dummies, dummyweakref);
|
||||
}
|
||||
if (PyErr_Occurred())
|
||||
if (PyDict_Pop(self->dummies, dummyweakref, NULL) < 0) {
|
||||
PyErr_WriteUnraisable((PyObject*)self);
|
||||
}
|
||||
}
|
||||
Py_DECREF(self);
|
||||
Py_RETURN_NONE;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue