Skip to content

Free Threading fixes - #10196

Merged
radarhere merged 32 commits into
python-pillow:mainfrom
wiredfool:free_thread_mutex
Oct 13, 2026
Merged

radarhere merged 32 commits into
python-pillow:mainfrom
wiredfool:free_thread_mutex

Conversation

@wiredfool

Copy link
Copy Markdown
Member

Changes proposed in this pull request:

  • Adds mutex to pixel buffer access, preventing concurrent multiple thread access to the underlying pixel buffers
  • Adds critical section to _imaging.c methods taking 1 or 2 python objects, preventing concurrent multiple thread access to a single image.
  • Add Critical section to cms_transform_apply
  • Fix race of PyType_Ready for path, outline, display
  • Call PyType_Ready once for encode/decode, not once per object.
  • Mutex for global use_block_allocator

radarhere and others added 30 commits April 2, 2026 00:12
* Also delete old palette after assignment. (Note, this is already in
a critical section, so not strictly necessary)
* most factories don't need to lock self because they don't use it
* Alpha composite and blend need a 2 image lock.
* Removed critical section from factories that don't reference self
@radarhere radarhere changed the title Free Threading Fixes Free Threading fixes Oct 13, 2026
Comment thread src/_imaging.c Outdated
@radarhere
radarhere merged commit 9ddcb85 into python-pillow:main Oct 13, 2026
66 of 68 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Free-threading PEP 703 support

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants