◐ Shell
clean mode source ↗

gh-116146: Add C-API to create module from spec and initfunc by itamaro · Pull Request #139196 · python/cpython

@bedevere-app Bot mentioned this pull request

Sep 21, 2025

encukou

vstinner

- use `PyImport_CreateModuleFromInitfunc` for the new API
- no need to introduce `create_builtin_ex` - update `create_builtin` and all callers
- update exception message
- remove unused `found` variable
- use `my_test_extension` instead of `embedded_ext` (the former is free-threading-ready, the latter prints a warning)

@itamaro itamaro changed the title gh-116146: Add new C-API to create builtin from spec and initfunc gh-116146: Add C-API to create module from spec and initfunc

Nov 9, 2025

@itamaro itamaro marked this pull request as ready for review

November 9, 2025 01:01

kumaraditya303

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
* Test single-phase init as well; don't use private APIs in test
* Doc update

---------

Co-authored-by: Itamar Oren <itamarost@gmail.com>

vstinner

Co-authored-by: Victor Stinner <vstinner@python.org>
…on under the free-threaded build

vstinner

encukou

kumaraditya303

kumaraditya303

kumaraditya303

Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
Co-authored-by: Victor Stinner <vstinner@python.org>

@itamaro

vstinner

kumaraditya303

@itamaro

encukou added a commit to encukou/cpython that referenced this pull request

Nov 14, 2025

@itamaro itamaro deleted the gh-116146-create-builtin-initfunc branch

November 15, 2025 23:40

StanFromIreland pushed a commit to StanFromIreland/cpython that referenced this pull request

Dec 6, 2025
…ythonGH-139196)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
Co-authored-by: Petr Viktorin <encukou@gmail.com>
Co-authored-by: Victor Stinner <vstinner@python.org>