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

Prevent building in GIL-less environment #4327

Merged
merged 6 commits into from
Jul 10, 2024

Conversation

FlickerSoul
Copy link
Contributor

This PR lets PyO3 checks Py_GIL_DISABLED build flag and prevents building against GIL-less Python, unless explicitly opt in the UNSAFE_PYO3_BUILD_FREE_THREADED flag.

@FlickerSoul
Copy link
Contributor Author

Hi! the benches CI check fails because of SSL errors from curl. Could you schedule a rerun for it?

Copy link
Member

@davidhewitt davidhewitt left a comment

Choose a reason for hiding this comment

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

Thanks, looks great! I'm going to add one tiny adjustment to the wording, and try to push a test, and then let's merge 👍

pyo3-ffi/build.rs Outdated Show resolved Hide resolved
@FlickerSoul
Copy link
Contributor Author

Thanks! I'll push a test in a moment!

@davidhewitt
Copy link
Member

Thanks 👍

I think easiest place to put a test would be in the test-version-limits job in noxfile.py, which overrides the build config and checks for success / failure. Could add one there to set the flag and check it fails to build (unless the env var is set).

Copy link
Member

@davidhewitt davidhewitt left a comment

Choose a reason for hiding this comment

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

Super, thanks, let's give this a spin!

pyo3-ffi/build.rs Show resolved Hide resolved
@FlickerSoul
Copy link
Contributor Author

Thank you!

auto-merge was automatically disabled July 10, 2024 15:27

Head branch was pushed to by a user without write access

@davidhewitt davidhewitt added this pull request to the merge queue Jul 10, 2024
Merged via the queue into PyO3:main with commit 6be8064 Jul 10, 2024
40 of 42 checks passed
davidhewitt added a commit that referenced this pull request Jul 16, 2024
* Prevent building in GIL-less environment

* Add change log

* add "yet" to phrasing

* Add testing to build script

* add link to issue

* Fix formatting issues

---------

Co-authored-by: David Hewitt <mail@davidhewitt.dev>
davidhewitt added a commit that referenced this pull request Jul 16, 2024
* Prevent building in GIL-less environment

* Add change log

* add "yet" to phrasing

* Add testing to build script

* add link to issue

* Fix formatting issues

---------

Co-authored-by: David Hewitt <mail@davidhewitt.dev>
davidhewitt added a commit that referenced this pull request Jul 17, 2024
* Prevent building in GIL-less environment

* Add change log

* add "yet" to phrasing

* Add testing to build script

* add link to issue

* Fix formatting issues

---------

Co-authored-by: David Hewitt <mail@davidhewitt.dev>
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.

Creating Module With pymodule Cause Segmentation Fault In Free-Threaded Python 3.13 On Mac
2 participants