Skip to content
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

Plan to support free-threaded Python #1555

Open
rostan-t opened this issue Nov 22, 2024 · 2 comments
Open

Plan to support free-threaded Python #1555

rostan-t opened this issue Nov 22, 2024 · 2 comments

Comments

@rostan-t
Copy link

rostan-t commented Nov 22, 2024

In free-threaded build, importing pydantic_core currently results in a segmentation fault. PyO3 v0.23 introduces support for free-threaded Python and addresses this issue. Is there any short-term plan to migrate to PyO3 0.23?

Currently I see the following blockers:

  • Jiter support for free-threaded Python (support free-threaded Python jiter#165)
  • Making SerializationCallable Sync, which isn't because of CollectWarnings and SerRecursionState contain RefCells
  • Replacing IntoPy/ToPyObject by IntoPyObject
  • Replacing calls to deprecated APIs (*_bound methods, into_py/to_object)
@davidhewitt
Copy link
Contributor

Yes, I was testing PyO3 0.23 (when it was just a git branch) in #1450 and plan to proceed further with that upgrade this week.

There is potentially additional work required beyond your list to actually make free-threaded support ok, both here and in pydantic (where there are a bunch of caches which may or may not be thread-safe).

@davidhewitt
Copy link
Contributor

davidhewitt commented Dec 2, 2024

PyO3 has now been bumped but there's a build failure on aarch64 on main. I'm trying to identify the cause. Before we can call free-threaded Python supported we should probably add extensive testing here and downstream in the pydantic main Python repo. I think this is realistically a Pydantic 2.11 feature cc @pydantic/oss

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

No branches or pull requests

2 participants