bigcat88 / pillow_heif

Python library for working with HEIF images and plugin for Pillow.
BSD 3-Clause "New" or "Revised" License
219 stars 17 forks source link

Improve error handling in `_pillow_heif.c` #298

Closed johncf closed 1 month ago

johncf commented 1 month ago

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 a System Error apparently because an exception was set earlier but was never thrown. This PR aims to fix some of these issues where returning NULL 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.

codecov[bot] commented 1 month ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 100.00%. Comparing base (b4b5d64) to head (3099979). Report is 1 commits behind head on master.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #298 +/- ## ========================================= Coverage 100.00% 100.00% ========================================= Files 10 10 Lines 956 956 ========================================= Hits 956 956 ```
johncf commented 1 month ago

Can we merge?

Yes, this is ready to merge. Should I merge, or do you merge?

bigcat88 commented 1 month ago

thanks for this PR, ping me in another PR when it's ready =)