Skip to content

gh-134160: Improve multi-phase init note on isolation & subinterpreters #134775

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 4 commits into from
May 30, 2025
Merged
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
Apply suggestions from code review
Co-authored-by: Adam Turner <[email protected]>
  • Loading branch information
encukou and AA-Turner authored May 28, 2025
commit 3b0514d5d34bcd012318c3951c8ec24e287751e0
8 changes: 4 additions & 4 deletions Doc/c-api/module.rst
Original file line number Diff line number Diff line change
Expand Up @@ -294,12 +294,12 @@ The distinction is similar to the :py:meth:`~object.__new__` and
Unlike modules created using single-phase initialization, these modules are not
singletons.
For example, if the :py:attr:`sys.modules` entry is removed and the module
is re-imported, a new module object is created, and, typically, populated with
fresh method and class objects.
is re-imported, a new module object is created, and typically populated with
fresh method and type objects.
The old module is subject to normal garbage collection.
This mirrors the behavior of pure-Python modules.

Additional module instances may also be created in
Additional module instances may be created in
:ref:`sub-interpreters <sub-interpreter-support>`
or after after Python runtime reinitialization
(:c:func:`Py_Finalize` and :c:func:`Py_Initialize`).
Expand All @@ -312,7 +312,7 @@ and all state, including references to Python objects, should be specific to
a particular module instance.
See :ref:`isolating-extensions-howto` for more details and a practical guide.

A simpler way to avoid the issues is
A simpler way to avoid these issues is
:ref:`raising an error on repeated initialization <isolating-extensions-optout>`.

All modules created using multi-phase initialization are expected to support
Expand Down
Loading