Skip to content

python 3.14 and free-threading - #36

Merged
MKuranowski merged 2 commits into
MKuranowski:masterfrom
ericbuehl:eb-ft
May 22, 2026
Merged

MKuranowski merged 2 commits into
MKuranowski:masterfrom
ericbuehl:eb-ft

Conversation

@ericbuehl

@ericbuehl ericbuehl commented May 9, 2026 •

Copy link
Copy Markdown
Contributor

near as I can tell there is no shared state that requirers the GIL to lock around. this PR:

  • declares the gil is not needed
  • removes deprecated PyUnicode_READY
  • tests and builds on python 3.13t, 3.14, 3.14t

closes #35

@MKuranowski

Copy link
Copy Markdown
Owner

Oh nice, so nothing needs to be done to add support for free-threading? Just out of curiosity, what patterns would usually require changes for free threading?

As for PyUnicode_READY - reading the documentation for it, it was definitely needed on 3.9. While it was marked as deprecated in 3.10, I think it's still possible that other modules (readers) used the deprecated functions to create strings. It's a guaranteed no-op only starting with 3.12.

I know that 3.9 is now EOL; it's fine to just drop support for it (but PyUnicode_READY would need to stay until 3.11 is EOL). The code still has some older leftovers from 3.8 support, and I vaguely even remember that it might be possible to restrict aiocsv to the limited C API starting with 3.10.

@ericbuehl ericbuehl mentioned this pull request May 9, 2026
@ericbuehl

Copy link
Copy Markdown
Contributor Author

I created another PR to address the dropping of 3.9: #37

as for gil-free, I'm pretty new, but going off of this guide: https://py-free-threading.github.io/porting/

@MKuranowski
MKuranowski merged commit 5d86d10 into MKuranowski:master May 22, 2026
8 checks passed
@MKuranowski

Copy link
Copy Markdown
Owner

To me it looks like there were actually 2 things that could be problematic:

  • concurrent access to ModuleState* - but all operations are read-only and don't mutate anything, so that's fine
  • concurrent access to Parser* - especially the raw memory it allocates - one thread could be reading from that memory, while another could be re-allocating it, causing a use-after-free. I've added a check to ensure parser instances are not shared across threads, as that would be bonkers anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

free-threading support

2 participants