Skip to content

Implement PEP793 initialization#7333

Open
da-woods wants to merge 14 commits intocython:masterfrom
da-woods:pep-793-init
Open

Implement PEP793 initialization#7333
da-woods wants to merge 14 commits intocython:masterfrom
da-woods:pep-793-init

Conversation

@da-woods
Copy link
Copy Markdown
Contributor

Closes #7276

Will be needed for Stable ABI+freethreading support (in the future).

Closes cython#7276

Will be needed for Stable ABI+freethreading support (in the
future).
@da-woods
Copy link
Copy Markdown
Contributor Author

I'm going to mark this as draft until Python 3.15a2 is out because it's hard to meaningfully test. I've given it a quick go with a local build of Python main (with the version number tweaked) but that doesn't mean everything will work.

@da-woods
Copy link
Copy Markdown
Contributor Author

Closing and reopening - I believe this should work with the release of alpha 2

@da-woods da-woods closed this Nov 19, 2025
@da-woods da-woods reopened this Nov 19, 2025
@da-woods da-woods marked this pull request as ready for review November 19, 2025 21:55
@da-woods
Copy link
Copy Markdown
Contributor Author

I think there's a bug with extension modules disabling the GIL. I've reported it at python/cpython#141780.

When I get confirmation that this is a bug and not just me missing something important then I'll put this in draft again until alpha3.

@da-woods da-woods marked this pull request as draft November 20, 2025 18:29
@da-woods da-woods marked this pull request as ready for review December 17, 2025 08:07
code.putln("#if CYTHON_PEP489_MULTI_PHASE_INIT")
code.putln("{")
code.putln("#if __PYX_LIMITED_VERSION_HEX >= 0x030F0000 && CYTHON_COMPILING_IN_LIMITED_API")
# We still define the PyInit function because setuptools will try to export it, but it's unusable with
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Note that this should be addressed by pypa/distutils#395. Once that gets merged and then propagates into a new setuptools release, this can be dropped.

@rgommers
Copy link
Copy Markdown
Contributor

It would be nice to merge this PR. We're trying to give the 3.15 stable ABI support a push, and are finishing up this testing repo which contains test packages that use PEP 793 and a test matrix of build backends x binding generators. This seems safe enough, and with 3.15.0a3 available in setup-python, the needed bug fix is now fairly widely available.

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.

Implement PEP-793 - PyModExport: A new entry point for C extension modules

2 participants