You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Avoid passing /EXPORT:PyInit_* to MSVC for Python 3.15+ (PEP 793) #387
Luckily the workaround is easy: add a PyInit_* function (one that's backwards-compatible, or one that always raises, depending on desired behaviour 3.14 and below). However, it would be great if no workaround was necessary. Also, as of 3.15 alpha 2 there's no pressing reason for extensions to migrate to PyModExport (but this will probably change with stable ABI for free-threading).
The /EXPORT option should not be necessary. According to MSVC docs, it's preferred to use __declspec(dllexport) in the source code instead. And CPython's PyMODINIT_FUNC macro does add the __declspec(dllexport).
Would it be acceptable for setuptools to avoid adding /EXPORT (or auto-filling export_opts) when compiling for CPython 3.15+?
I'd like to solve any issues on the CPython side, ideally in the alpha period:
If PyMODINIT_FUNC not adding __declspec(dllexport) in some cases, let's fix that
PyMODINIT_FUNC being only recommended (IMO, “Porting to Python 3.15” in CPython's What's New can say that build tools are now not expected to handle this, and so PyMODINIT_FUNC or equivalent is needed in the source)
+1 this seems like a good idea. Avoiding /EXPORT completely would be nicest imho, but either way works.
I'm not a maintainer, but I do have a decent amount of experience with this code, and I'm happy to help test/review a PR to change the >=3.15 behavior.
Thanks!
I've sent #395 for this. If you can review or have any comments on it, it would be welcome! (Especially if you regularly use Windows and can easily test there.)
Activity
rgommers commentedon Dec 30, 2025
+1 this seems like a good idea. Avoiding
/EXPORTcompletely would be nicest imho, but either way works.I'm not a maintainer, but I do have a decent amount of experience with this code, and I'm happy to help test/review a PR to change the >=3.15 behavior.
encukou commentedon Jan 13, 2026
Thanks!
I've sent #395 for this. If you can review or have any comments on it, it would be welcome! (Especially if you regularly use Windows and can easily test there.)
Add a fallback `PyInit_limited()` for setuptools on Windows
Add a fallback `PyInit_limited()` for setuptools on Windows