Skip to content

Commit e62e56c

Browse files
committed
Enhance documentation
1 parent 5ff278c commit e62e56c

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

Doc/c-api/init_config.rst

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -247,8 +247,25 @@ Initialization Callback
247247
Python interpreter is initialized, before the first import. For example, it
248248
can be used to add a meta path importer into :data:`sys.meta_path`.
249249
250-
Python is not fully initialized yet when the callback is called. For
251-
example, :data:`sys.stdout` may not exist yet.
250+
When the callback is called, Python is only partially initialized. What's
251+
available at this point:
252+
253+
* Builtin types;
254+
* Builtin exceptions;
255+
* Builtin and frozen modules (can be imported);
256+
* The :mod:`sys` module is only partially initialized
257+
(ex: :data:`sys.path` and :data:`sys.stdout` don't exist yet).
258+
259+
After the callback, the Python initialization is completed:
260+
261+
* Install and configure :mod:`importlib`;
262+
* Apply the :ref:`Path Configuration <init-path-config>`;
263+
* Install signal handlers;
264+
* Finish :mod:`sys` module initialization (ex: create :data:`sys.stdout`
265+
and :data:`sys.path`);
266+
* Enable optional features like :mod:`faulthandler` and :mod:`tracemalloc`;
267+
* Import the :mod:`site` module;
268+
* etc.
252269
253270
A single callback can be registered. If this function is called more than
254271
once, the previous callback is overridden.

0 commit comments

Comments
 (0)