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 7244cdc

Browse filesBrowse files
committed
gh-112087: Test fix for test_sched leak
1 parent 5dc8c84 commit 7244cdc
Copy full SHA for 7244cdc

File tree

Expand file treeCollapse file tree

2 files changed

+16
-0
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+16
-0
lines changed

‎Include/internal/pycore_gc.h

Copy file name to clipboardExpand all lines: Include/internal/pycore_gc.h
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,9 @@ extern PyObject *_PyGC_GetReferrers(PyInterpreterState *interp, PyObject *objs);
288288
extern void _PyGC_ClearAllFreeLists(PyInterpreterState *interp);
289289
extern void _Py_ScheduleGC(PyThreadState *tstate);
290290
extern void _Py_RunGC(PyThreadState *tstate);
291+
#ifdef Py_GIL_DISABLED
292+
extern void _PyGC_Clear_DelayedObjects(PyInterpreterState *interp);
293+
#endif
291294

292295
#ifdef __cplusplus
293296
}

‎Python/gc_free_threading.c

Copy file name to clipboardExpand all lines: Python/gc_free_threading.c
+13Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1154,6 +1154,7 @@ gc_collect_main(PyThreadState *tstate, int generation, _PyGC_Reason reason)
11541154
}
11551155
}
11561156

1157+
_PyGC_Clear_DelayedObjects(interp);
11571158
/* Update stats */
11581159
struct gc_generation_stats *stats = &gcstate->generation_stats[generation];
11591160
stats->collections++;
@@ -1758,4 +1759,16 @@ _PyGC_ClearAllFreeLists(PyInterpreterState *interp)
17581759
HEAD_UNLOCK(&_PyRuntime);
17591760
}
17601761

1762+
void
1763+
_PyGC_Clear_DelayedObjects(PyInterpreterState *interp)
1764+
{
1765+
HEAD_LOCK(&_PyRuntime);
1766+
PyThreadState *tstate = interp->threads.head;
1767+
while (tstate != NULL) {
1768+
_PyMem_ProcessDelayed(tstate);
1769+
tstate = (PyThreadState *)tstate->next;
1770+
}
1771+
HEAD_UNLOCK(&_PyRuntime);
1772+
}
1773+
17611774
#endif // Py_GIL_DISABLED

0 commit comments

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