Skip to content

Commit

Permalink
encode: Replace PyDict_GetItem with PyDict_GetItemRef
Browse files Browse the repository at this point in the history
  • Loading branch information
hugovk committed Jul 4, 2024
1 parent dd2ddff commit 675ee74
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/encode.c
Original file line number Diff line number Diff line change
Expand Up @@ -722,7 +722,10 @@ PyImaging_LibTiffEncoderNew(PyObject *self, PyObject *args) {
}

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) {
int type_int = PyLong_AsLong(tag_type);
if (type_int >= TIFF_BYTE && type_int <= TIFF_DOUBLE) {
Expand Down

0 comments on commit 675ee74

Please sign in to comment.