encode: Replace PyDict_GetItem with PyDict_GetItemRef

This commit is contained in:
Hugo van Kemenade 2024-07-02 18:46:52 +03:00
parent 377bdc0db1
commit 7c64ae0c73

View File

@ -722,7 +722,10 @@ PyImaging_LibTiffEncoderNew(PyObject *self, PyObject *args) {
} }
if (!is_core_tag) { if (!is_core_tag) {
PyObject *tag_type = PyDict_GetItem(types, key); PyObject *tag_type;
if (PyDict_GetItemRef(types, key, &tag_type) == 0) {
PyErr_SetString(PyExc_KeyError, "unknown tag type");
}
if (tag_type) { if (tag_type) {
int type_int = PyLong_AsLong(tag_type); int type_int = PyLong_AsLong(tag_type);
if (type_int >= TIFF_BYTE && type_int <= TIFF_DOUBLE) { if (type_int >= TIFF_BYTE && type_int <= TIFF_DOUBLE) {