Skip to content

Commit 0560cac

Browse files
Tweak a comment.
1 parent 52f2e25 commit 0560cac

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

Python/import.c

+12-11
Original file line numberDiff line numberDiff line change
@@ -1161,11 +1161,11 @@ maybe_switch_to_main_interpreter(PyThreadState *tstate)
11611161
PyThreadState *main_tstate = tstate;
11621162
if (check_multi_interp_extensions(tstate->interp)) {
11631163
/*
1164-
If the module is single-phase init then the import
1165-
will fail. However, the module's init function will still
1166-
get run. That means it may still store state in the
1167-
shared-object/DLL address space (which never gets
1168-
closed/cleared), including objects (e.g. static types).
1164+
If the module is single-phase init then the import will fail.
1165+
However, the module's init function will still get run.
1166+
That means it may still store state in the shared-object/DLL
1167+
address space (which never gets closed/cleared), including
1168+
objects (e.g. static types).
11691169
11701170
This is a problem for isolated subinterpreters since each
11711171
has its own object allocator. If the loaded shared-object
@@ -1174,13 +1174,14 @@ maybe_switch_to_main_interpreter(PyThreadState *tstate)
11741174
or else any later use of that object by another interpreter
11751175
(or across multiple init-fini cycles) will crash the process.
11761176
1177-
We avoid the problem by first loading the module in the main
1178-
interpreter.
1177+
We avoid the problem by first loading the module
1178+
in the main interpreter.
11791179
1180-
Here's another complication: the module's init function might
1181-
register callbacks, whether in Python (e.g. sys.stdin, atexit)
1182-
or in linked libraries. Thus we cannot just dlclose() the
1183-
module in this error case.
1180+
Here's another complication we avoid: the module's init
1181+
function might register callbacks, whether in Python
1182+
(e.g. sys.stdin, atexit) or in linked libraries.
1183+
Thus we cannot just dlclose() the module
1184+
in this error case.
11841185
*/
11851186
main_tstate = PyThreadState_New(_PyInterpreterState_Main());
11861187
if (main_tstate == NULL) {

0 commit comments

Comments
 (0)