Uh oh!
There was an error while loading. Please reload this page.
gh-140550: Initial implementation of PEP 793 – PyModExport - #140556
Conversation
This uses a "def-like" structure: a PyModuleDef* that's not a valid Python object.
encukou
left a comment
There was a problem hiding this comment.
Thank you for the initial review!
Yes, but there's a lot of tests. And I've also renamed things that changed semantics, so unrelated changes/backports will conflict or fail to build, rather than merge cleanly at the Git level but be subtly broken.
| import unittest | ||
| import types |
There was a problem hiding this comment.
I couldn't find this in PEP 8.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
encukou
commented
Oct 28, 2025
!buildbot AMD64.FreeBSD.Refleaks |
bedevere-bot
commented
Oct 28, 2025
🤖 New build scheduled with the buildbot fleet by @encukou for commit 01d52ba 🤖 Results will be shown at: https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F140556%2Fmerge The command will test the builders whose names match following regular expression: The builders matched are:
|
Uh oh!
There was an error while loading. Please reload this page.
encukou
commented
Oct 29, 2025
Yes. There's a lot to add since the PEP calls for soft-deprecation of |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
Uh oh!
There was an error while loading. Please reload this page.
vstinner
left a comment
There was a problem hiding this comment.
LGTM. Just please move _PyModule_GetGCHooks() to pycore_moduleobject.h.
| static inline PyModuleDef *_PyModule_GetDefOrNull(PyObject *arg) { | ||
| PyModuleObject *mod = _PyModule_CAST(arg); | ||
| if (mod->md_token_is_def) { | ||
| return (PyModuleDef *)((PyModuleObject *)mod)->md_token; |
There was a problem hiding this comment.
| return (PyModuleDef*)((PyModuleObject*)mod)->md_token; | |
| return (PyModuleDef*)mod->md_token; |
Uh oh!
There was an error while loading. Please reload this page.
| PyMODINIT_FUNC | ||
| FUNC_NAME(MODULE_NAME)(void) | ||
| INITFUNC_NAME(MODULE_NAME)(void) |
There was a problem hiding this comment.
Is it really needed to define a PyInit function if a modexport function is defined with slots? Developers may reuse this code as an example.
There was a problem hiding this comment.
Thanks for the catch! I think I had some platform-specific issues with the current version of setuptools. I added this to the TODO list in the issue; I'll get to it in a later PR.
Uh oh!
There was an error while loading. Please reload this page.
encukou
commented
Nov 5, 2025
Thank you for the review! |
vstinner
commented
Nov 5, 2025
Congrats :-) |
vstinner
commented
Nov 5, 2025
I created #141056 to fix the issue. |
encukou
commented
Nov 5, 2025
Thank you! |
…honGH-140556) Co-authored-by: Victor Stinner <vstinner@python.org> Co-authored-by: Kumar Aditya <kumaraditya@python.org>
This adds the initial implementation of PEP-793.
See the issue for follow-up tasks.