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

Define Py_GIL_DISABLED macro on Windows #2442

Merged
merged 1 commit into from
Sep 30, 2024

Conversation

cvijdea-bd
Copy link
Contributor

Summary

  • OS: Windows
  • Bug fix: yes
  • Type: wheels
  • Fixes: bad build for 3.13t (free-threading/nogil) on windows

Description

python/cpython#111650
CPython doesn't ensure Py_GIL_DISABLED is defined when building against the free-threading interpreter, and setuptools doesn't either.

If it is not defined the resulting module will have the 313t abi tag but will crash on import due to linking to python313.dll instead of python313t.dll.

@giampaolo
Copy link
Owner

@colesbury is it necessary to do this for all C extensions on Windows? Shouldn't cPython do it automatically?

@cvijdea-bd
Copy link
Contributor Author

Opened pypa/setuptools#4662 since discussion on the linked cpython issue seemed to imply they believe it should be setuptools' job to handle it.

python/cpython#111650

Signed-off-by: Cristi Vîjdea <cvijdea@bitdefender.com>
@colesbury
Copy link
Contributor

is it necessary to do this for all C extensions on Windows?

Yes, I think so, at least for now.

Shouldn't cPython do it automatically?

That would be much better, but I think the way the Python Windows installer works makes that not possible. We should probably work on getting setuptools to define Py_GIL_DISABLED on Windows for free-threaded extensions.

@giampaolo
Copy link
Owner

Thank you @colesbury and @cvijdea-bd! I am merging this then.

@giampaolo giampaolo merged commit a06e762 into giampaolo:master Sep 30, 2024
13 of 14 checks passed
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.

3 participants