Skip to content

Avoid passing NULL to PyDict_SetItemString#19

Merged
radarhere merged 3 commits intoradarhere:reference_countfrom
nulano:reference-count
Mar 22, 2023
Merged

Avoid passing NULL to PyDict_SetItemString#19
radarhere merged 3 commits intoradarhere:reference_countfrom
nulano:reference-count

Conversation

@nulano
Copy link

@nulano nulano commented Mar 21, 2023

For python-pillow#7003

Two suggestions:

The PyDict_SetItemString function (indirectly) calls assert(value) here: https://github.com/python/cpython/blob/ef000eb3e2a8d0ecd51b6d44b390fefd820a61a6/Objects/dictobject.c#L1838

I would suggest replacing all PyDict_SetItemString(..., value) calls with PyDict_SetItemString(..., value ? value : Py_None), with the exception of the unused private attribute _imagingmorph.__version which can be removed without deprecation.

@Yay295
Copy link

Yay295 commented Mar 22, 2023

Did you mean to change the variable names to v in some of the files?

@nulano
Copy link
Author

nulano commented Mar 22, 2023

Yes, to fit the line length limit for code style without breaking lines.

@radarhere radarhere merged commit 9ef65b0 into radarhere:reference_count Mar 22, 2023
@nulano nulano deleted the reference-count branch March 22, 2023 02:20
radarhere added a commit that referenced this pull request Feb 3, 2025
Co-authored-by: Andrew Murray <radarhere@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants