-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Move away from APIs that use borrowed references under the free-threaded build #8216
Conversation
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.
LGTM! Let's merge this.
pythoncapi_compat.h has been added in it's entirety, but if I'm reading this right, we're only using Was the entire file added just for simplicity, or do you expect that other functions will be used in the future as well? |
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 :) |
The file is currently 1103 bytes, so I don't consider size to be a problem. I just wanted to clarify the rationale. |
They appear to all be |
For #8199.
Make a start on making Pillow's code ready for free-threading (PEP 703).
This is some of the low-hanging fruit from https://docs.python.org/3.13/howto/free-threading-extensions.html.
Declare extension modules can support running with the GIL disabled. We use single-phase initialisation.
Replace functions that return borrowed references with strong references, using https://github.com/python/pythoncapi-compat
Plus from @lysnikolaou: don't use
PyList_GetItemRef
immediately afterPyList_New