Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit d8135e9

Browse filesBrowse files
authored
bpo-40533: Disable GC in subinterpreters (GH-19961)
When Python is built with experimental isolated interpreters, a garbage collection now does nothing in an isolated interpreter. Temporary workaround until subinterpreters stop sharing Python objects.
1 parent 89fc4a3 commit d8135e9
Copy full SHA for d8135e9

File tree

1 file changed

+8
-0
lines changed
Filter options

1 file changed

+8
-0
lines changed

‎Modules/gcmodule.c

Copy file name to clipboardExpand all lines: Modules/gcmodule.c
+8Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1181,6 +1181,14 @@ collect(PyThreadState *tstate, int generation,
11811181
_PyTime_t t1 = 0; /* initialize to prevent a compiler warning */
11821182
GCState *gcstate = &tstate->interp->gc;
11831183

1184+
#ifdef EXPERIMENTAL_ISOLATED_SUBINTERPRETERS
1185+
if (tstate->interp->config._isolated_interpreter) {
1186+
// bpo-40533: The garbage collector must not be run on parallel on
1187+
// Python objects shared by multiple interpreters.
1188+
return 0;
1189+
}
1190+
#endif
1191+
11841192
if (gcstate->debug & DEBUG_STATS) {
11851193
PySys_WriteStderr("gc: collecting generation %d...\n", generation);
11861194
show_stats_each_generations(gcstate);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.