Skip to content

Conversation

@wuxiaobai24
Copy link

This PR adds Python 3.14 free-threaded mode support to CocoIndex, resolving #1187

Key Changes:

  • Configure PyO3 for free-threaded mode (gil_used = false)
  • Add free-threaded feature and dependencies
  • Add Python 3.14 free-threaded test workflow

@badmonster0 badmonster0 requested a review from georgeh0 December 2, 2025 06:14
[features]
default = ["legacy-states-v0"]
legacy-states-v0 = []
legacy-states-v0 = [ "pyo3/abi3-py311"]
Copy link
Member

Choose a reason for hiding this comment

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

Let's enable this feature by default (just put it in pyo3 below). It doesn't belong to legacy-states-v0

Copy link
Author

Choose a reason for hiding this comment

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

abi3-py311 now lives in a new abi3 feature which is part of default.

default = ["legacy-states-v0"]
legacy-states-v0 = []
legacy-states-v0 = [ "pyo3/abi3-py311"]
free-threaded = []
Copy link
Member

Choose a reason for hiding this comment

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

Seems this one is not used anywhere.

Copy link
Author

Choose a reason for hiding this comment

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

This feature now controls whether #[pymodule] is declared with gil_used = false.

Comment on lines +606 to +607
#[cfg_attr(feature = "free-threaded", pymodule(gil_used = false))]
#[cfg_attr(not(feature = "free-threaded"), pymodule)]
Copy link
Member

Choose a reason for hiding this comment

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

I think we don't need two branches here. We can always declare gil_used = false.

Based on the documentation, as long as our code is thread safe, we can use gil_used = false here. When it's declared false, both with-gil and thread-safe python can use it.

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.

2 participants