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.
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
Handle failure from PyDict_New or PyList_New #6999
Handle failure from PyDict_New or PyList_New #6999
Changes from 7 commits
929dbba
b3d7823
c7d4d1f
dfeed0e
dc79a09
0ea1184
7632d8d
448ab0a
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
geterror
, used for error handling elsewhere here, callsPyErr_SetString
before returningNULL
; maybe these should have something too instead of just returning NULL..? (Repeated for other barereturn NULL;
s in this PR.)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My thinking was to copy behaviour is already used in Pillow in another location.
Pillow/src/_imaging.c
Lines 3819 to 3822 in 2b16494
Looking at CPython, I think that
PyList_New
already sets an error before returning. The same withPyDict_New
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, great, so it seems 👍
(I'd personally probably add a comment that says something like
// Error set by PyDict_New
on the return line, but that's fine.)