]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.14] gh-141004: Document `PyImport_Inittab` (GH-141844) (GH-141915)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Mon, 24 Nov 2025 17:16:31 +0000 (18:16 +0100)
committerGitHub <noreply@github.com>
Mon, 24 Nov 2025 17:16:31 +0000 (12:16 -0500)
gh-141004: Document `PyImport_Inittab` (GH-141844)
(cherry picked from commit 5f35702bb641230131c400500bb8bbacde7465b2)

Co-authored-by: Peter Bierma <zintensitydev@gmail.com>
Co-authored-by: Stan Ulbrych <stan@ulbrych.org>
Co-authored-by: Victor Stinner <vstinner@python.org>
Doc/c-api/import.rst
Doc/extending/extending.rst
Misc/NEWS.d/3.11.0a1.rst
Misc/NEWS.d/3.12.0a2.rst

index 1cab3ce3061ec90bae07fb336920413954aff408..369e95dd02251b413b807917aeb5c51734e96655 100644 (file)
@@ -327,6 +327,13 @@ Importing Modules
    initialization.
 
 
+.. c:var:: struct _inittab *PyImport_Inittab
+
+   The table of built-in modules used by Python initialization. Do not use this directly;
+   use :c:func:`PyImport_AppendInittab` and :c:func:`PyImport_ExtendInittab`
+   instead.
+
+
 .. c:function:: PyObject* PyImport_ImportModuleAttr(PyObject *mod_name, PyObject *attr_name)
 
    Import the module *mod_name* and get its attribute *attr_name*.
index dee92312169a276e474a03903b005037a25bce00..f9b65643dfe888006a149de0a22b50f17e539abb 100644 (file)
@@ -426,7 +426,7 @@ A pointer to the module definition must be returned via :c:func:`PyModuleDef_Ini
 so that the import machinery can create the module and store it in ``sys.modules``.
 
 When embedding Python, the :c:func:`!PyInit_spam` function is not called
-automatically unless there's an entry in the :c:data:`!PyImport_Inittab` table.
+automatically unless there's an entry in the :c:data:`PyImport_Inittab` table.
 To add the module to the initialization table, use :c:func:`PyImport_AppendInittab`,
 optionally followed by an import of the module::
 
index f58d6b657e9b9509dd5a2b01629734be2d318a15..ab998ca73abf40af3ee10f3f33e8f1821f6e5bb6 100644 (file)
@@ -4931,7 +4931,7 @@ Patch by Gabriele N. Tornetta
 .. nonce: 3p14JB
 .. section: C API
 
-:c:func:`Py_RunMain` now resets :c:data:`!PyImport_Inittab` to its initial
+:c:func:`Py_RunMain` now resets :c:data:`PyImport_Inittab` to its initial
 value at exit. It must be possible to call :c:func:`PyImport_AppendInittab`
 or :c:func:`PyImport_ExtendInittab` at each Python initialization. Patch by
 Victor Stinner.
index bc028f30636bf7ebbac648ce665aafd9c87aee88..20e27c0d92f05f269cc846a15c4fc24a4d8b65cc 100644 (file)
@@ -35,11 +35,11 @@ Update bundled libexpat to 2.5.0
 .. nonce: ik4iOv
 .. section: Core and Builtins
 
-The docs clearly say that ``PyImport_Inittab``,
+The docs clearly say that :c:data:`PyImport_Inittab`,
 :c:func:`PyImport_AppendInittab`, and :c:func:`PyImport_ExtendInittab`
 should not be used after :c:func:`Py_Initialize` has been called. We now
 enforce this for the two functions.  Additionally, the runtime now uses an
-internal copy of ``PyImport_Inittab``, to guard against modification.
+internal copy of :c:data:`PyImport_Inittab`, to guard against modification.
 
 ..