Move away from APIs that use borrowed references under the free-threaded build by hugovk · Pull Request #8216 · python-pillow/Pillow

@hugovk

lysnikolaou

lysnikolaou

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Let's merge this.

@hugovk hugovk deleted the free-threading branch

July 13, 2024 14:09

@radarhere

pythoncapi_compat.h has been added in it's entirety, but if I'm reading this right, we're only using PyList_GetItemRef() and PyDict_GetItemRef().

Was the entire file added just for simplicity, or do you expect that other functions will be used in the future as well?

@hugovk

I thought about only including what we use, but added the whole thing for simplicity. It also makes updating it easier, and we might use more in the future.

I'm not against using a minimal file, but then again, does it affect compiled executable size (at all or significantly)? (I'm on a plane waiting to take off so can't test right now :)

@radarhere

The file is currently 1103 bytes, so I don't consider size to be a problem. I just wanted to clarify the rationale.

@nulano

does it affect compiled executable size (at all or significantly)

They appear to all be static inline functions, so as far as I understand (I also checked GCC on godbolt.org), only those functions that we actually use should be included in the compiled executable.

radarhere added a commit to radarhere/Pillow that referenced this pull request

Feb 5, 2025

radarhere added a commit to radarhere/Pillow that referenced this pull request

Feb 5, 2025

radarhere added a commit to radarhere/Pillow that referenced this pull request

Feb 7, 2025

radarhere added a commit to radarhere/Pillow that referenced this pull request

Feb 7, 2025