mirror of
https://github.com/python/cpython.git
synced 2025-09-27 10:50:04 +00:00
gh-111789: Use PyDict_GetItemRef() in Modules/pyexpat.c (gh-112079)
This commit is contained in:
parent
ef9b2fc9b0
commit
d8908932fc
1 changed files with 5 additions and 12 deletions
|
@ -240,19 +240,12 @@ string_intern(xmlparseobject *self, const char* str)
|
||||||
return result;
|
return result;
|
||||||
if (!self->intern)
|
if (!self->intern)
|
||||||
return result;
|
return result;
|
||||||
value = PyDict_GetItemWithError(self->intern, result);
|
if (PyDict_GetItemRef(self->intern, result, &value) == 0 &&
|
||||||
if (!value) {
|
PyDict_SetItem(self->intern, result, result) == 0)
|
||||||
if (!PyErr_Occurred() &&
|
{
|
||||||
PyDict_SetItem(self->intern, result, result) == 0)
|
return result;
|
||||||
{
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
Py_DECREF(result);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Py_INCREF(value);
|
assert((value != NULL) == !PyErr_Occurred());
|
||||||
Py_DECREF(result);
|
Py_DECREF(result);
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue