Skip to content

Avoid passing NULL to PyDict_SetItemString #19

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 22, 2023

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