-
Notifications
You must be signed in to change notification settings - Fork 18
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
Improve error handling in _pillow_heif.c
#298
Conversation
A MemoryError is already set when PyObject_New fails: https://github.com/python/cpython/blob/2f8301cbf/Objects/object.c#L459-L468
bb675e7
to
f94bbbc
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #298 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 10 10
Lines 956 956
=========================================
Hits 956 956 |
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.
PR is excellent, I am very surprised by such a serious approach.
Can we merge?
Yes, this is ready to merge. Should I merge, or do you merge? |
thanks for this PR, ping me in another PR when it's ready =) |
When I was working on #297, I noticed that functions that don't return
NULL
after setting error doesn't raise exception. But when an exception is later thrown, it causes Python to raise aSystem Error
apparently because an exception was set earlier but was never thrown. This PR aims to fix some of these issues where returningNULL
is more appropriate.Disclaimer: I am not an expert in Python C-API. I'm still learning (and have questions). So please review this carefully.