return result;
if (!self->intern)
return result;
- value = PyDict_GetItemWithError(self->intern, result);
- if (!value) {
- if (!PyErr_Occurred() &&
- PyDict_SetItem(self->intern, result, result) == 0)
- {
- return result;
- }
- else {
- Py_DECREF(result);
- return NULL;
- }
+ if (PyDict_GetItemRef(self->intern, result, &value) == 0 &&
+ PyDict_SetItem(self->intern, result, result) == 0)
+ {
+ return result;
}
- Py_INCREF(value);
+ assert((value != NULL) == !PyErr_Occurred());
Py_DECREF(result);
return value;
}