mirror of
https://github.com/python/cpython.git
synced 2025-12-04 00:30:19 +00:00
gh-111262: Add PyDict_Pop() function (#112028)
_PyDict_Pop_KnownHash(): remove the default value and the return type becomes an int. Co-authored-by: Stefan Behnel <stefan_ml@behnel.de> Co-authored-by: Antoine Pitrou <pitrou@free.fr>
This commit is contained in:
parent
f44d6ff6e0
commit
4f04172c92
15 changed files with 338 additions and 76 deletions
|
|
@ -967,11 +967,8 @@ local_clear(localobject *self)
|
|||
HEAD_UNLOCK(runtime);
|
||||
while (tstate) {
|
||||
if (tstate->dict) {
|
||||
PyObject *v = _PyDict_Pop(tstate->dict, self->key, Py_None);
|
||||
if (v != NULL) {
|
||||
Py_DECREF(v);
|
||||
}
|
||||
else {
|
||||
if (PyDict_Pop(tstate->dict, self->key, NULL) < 0) {
|
||||
// Silently ignore error
|
||||
PyErr_Clear();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue