Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
ditto
  • Loading branch information
neonene committed May 21, 2025
commit d6c42e2397dd7ddabc4b61baa2c37569a96e1452
4 changes: 3 additions & 1 deletion Doc/c-api/intro.rst
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,10 @@ complete listing.
item defined in the module file. Example::

static struct PyModuleDef spam_module = {
.m_base =PyModuleDef_HEAD_INIT,
.m_base = PyModuleDef_HEAD_INIT,
.m_name = "spam",
.m_size = 0,
.m_slots = spam_module_slots,
...
};

Expand Down
11 changes: 10 additions & 1 deletion Doc/extending/extending.rst
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ macro)::
return Py_None;

:c:data:`Py_None` is the C name for the special Python object ``None``. It is a
genuine Python object rather than a ``NULL`` pointer, which means "error" in most
genuine Python object rather than a ``NULL`` pointer, which means "SpamError" in most
contexts, as we have seen.


Expand Down Expand Up @@ -479,6 +479,15 @@ optionally followed by an import of the module::
Py_ExitStatusException(status);
}

.. note::

If you need to define *static* extension types rather than heap-allocated
types, the :c:data:`Py_mod_multiple_interpreters` slot in the example should
be ``Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED}``. Without it, the module
can create the same problems as the legacy single-phase initialization, when
removing entries from ``sys.modules`` or importing compiled modules into
multiple interpreters within a process (or following a :c:func:`fork` without an
intervening :c:func:`exec`).

.. _compilation:

Expand Down