8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ef9b2fc commit d890893Copy full SHA for d890893
Modules/pyexpat.c
@@ -240,19 +240,12 @@ string_intern(xmlparseobject *self, const char* str)
240
return result;
241
if (!self->intern)
242
243
- value = PyDict_GetItemWithError(self->intern, result);
244
- if (!value) {
245
- if (!PyErr_Occurred() &&
246
- PyDict_SetItem(self->intern, result, result) == 0)
247
- {
248
- return result;
249
- }
250
- else {
251
- Py_DECREF(result);
252
- return NULL;
253
+ if (PyDict_GetItemRef(self->intern, result, &value) == 0 &&
+ PyDict_SetItem(self->intern, result, result) == 0)
+ {
+ return result;
254
}
255
- Py_INCREF(value);
+ assert((value != NULL) == !PyErr_Occurred());
256
Py_DECREF(result);
257
return value;
258
0 commit comments