Skip to content

[3.14] gh-134160: Split extension module init from PyModule docs; emphasize multi-phase init (GH-135126) #135470

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

Merged
merged 1 commit into from
Jun 16, 2025

Conversation

miss-islington
Copy link
Contributor

@miss-islington miss-islington commented Jun 13, 2025

Document behaviour of single-phase init. Call it "legacy".

Reorganize PyModule docs.

Move PyInit_modulename docs from the tutorial to reference documentation.

Move PyMODINIT_FUNC docs from generic macros to the new page.

Add doc stubs for PYTHON_API_VERSION & PYTHON_ABI_VERSION

Remove incorrect refcounts.dat entry for PyModuleDef_Init.
This removes the "Return value: Borrowed reference." note.
Instead, note that the function sometimes returns a borrowed reference,
sometimes as strong one.
(IMO, it's best to not think of PyModuleDef as a PyObject at all,
and act like it can't be reference-counted.)

(cherry picked from commit f4bc3a9)

Co-authored-by: Petr Viktorin [email protected]
Co-authored-by: Adam Turner [email protected]
Co-authored-by: Stan Ulbrych [email protected]
Co-authored-by: Hugo van Kemenade [email protected]


📚 Documentation preview 📚: https://cpython-previews--135470.org.readthedocs.build/

…asize multi-phase init (pythonGH-135126)

Document behaviour of single-phase init. Call it "legacy".

Reorganize PyModule docs.

Move PyInit_modulename docs from the tutorial to reference documentation.

Move PyMODINIT_FUNC docs from generic macros to the new page.

Add doc stubs for `PYTHON_API_VERSION` & `PYTHON_ABI_VERSION`

Remove incorrect refcounts.dat entry for `PyModuleDef_Init`.
This removes the "Return value: Borrowed reference." note.
Instead, note that the function sometimes returns a borrowed reference,
sometimes as strong one.
(IMO, it's best to not think of `PyModuleDef` as a `PyObject` at all,
and act like it can't be reference-counted.)

(cherry picked from commit f4bc3a9)

Co-authored-by: Petr Viktorin <[email protected]>
Co-authored-by: Adam Turner <[email protected]>
Co-authored-by: Stan Ulbrych <[email protected]>
Co-authored-by: Hugo van Kemenade <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants