Skip to content

Conversation

@davidhewitt
Copy link
Member

Related to #5525 which has switched the default gil_used flag to false as part of that diff, also default modules created with PyModule::new to not require the GIL. This PR also takes the opportunity to add documentation to the migration guide.

@davidhewitt davidhewitt requested a review from ngoldbaum October 26, 2025 22:23
Copy link
Contributor

@ngoldbaum ngoldbaum left a comment

Choose a reason for hiding this comment

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

Super minor nits but otherwise looks great.

A module can opt-out of supporting free-threaded Python until it has audited its `unsafe` code for correctness by declaring the module with `#[pymodule(gil_used = true)]` (see below).

More complicated `#[pyclass]` types may need to deal with thread-safety directly; there is [a dedicated section of the guide](./class/thread-safety.md) to discuss this.
Complicated `#[pyclass]` types may need to deal with thread-safety directly; there is [a dedicated section of the guide](./class/thread-safety.md) to discuss this.
Copy link
Contributor

Choose a reason for hiding this comment

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

Want me to go over these docs once more to see if they still make sense with the new default?

Copy link
Member Author

Choose a reason for hiding this comment

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

Keeping docs fresh is always much appreciated! I think I got everything but will never say no to another pair of eyes 😄

davidhewitt and others added 2 commits November 1, 2025 14:45
Co-authored-by: Nathan Goldbaum <nathan.goldbaum@gmail.com>
@davidhewitt davidhewitt enabled auto-merge November 1, 2025 14:47
@davidhewitt davidhewitt added this pull request to the merge queue Nov 1, 2025
Merged via the queue into PyO3:main with commit 22a1846 Nov 1, 2025
42 of 43 checks passed
@davidhewitt davidhewitt deleted the default-gil-used-false branch November 1, 2025 18:15
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