Avoid passing NULL to PyDict_SetItemString #19
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
For python-pillow#7003
Two suggestions:
Py_DECREF(Py_None)
here: https://github.com/python-pillow/Pillow/pull/7003/files#diff-a7e6dcef8b0ae21843d090666c67e89f073e658f1d532b503f56cabd255e001cR1395NULL
toPyDict_SetItemString
The
PyDict_SetItemString
function (indirectly) callsassert(value)
here: https://github.com/python/cpython/blob/ef000eb3e2a8d0ecd51b6d44b390fefd820a61a6/Objects/dictobject.c#L1838I would suggest replacing all
PyDict_SetItemString(..., value)
calls withPyDict_SetItemString(..., value ? value : Py_None)
, with the exception of the unused private attribute_imagingmorph.__version
which can be removed without deprecation.