Skip to content

Commit 7f0bc57

Browse files
fix weird GC bugs
1 parent 67de7d6 commit 7f0bc57

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Python/optimizer.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1751,9 +1751,9 @@ _Py_Executors_InvalidateDependencyLockHeld(PyInterpreterState *interp, void *obj
17511751
void
17521752
_Py_Executors_InvalidateDependency(PyInterpreterState *interp, void *obj, int is_invalidation)
17531753
{
1754-
_PyEval_StopTheWorld(interp);
1754+
HEAD_LOCK(&_PyRuntime);
17551755
_Py_Executors_InvalidateDependencyLockHeld(interp, obj, is_invalidation);
1756-
_PyEval_StartTheWorld(interp);
1756+
HEAD_UNLOCK(&_PyRuntime);
17571757
}
17581758

17591759
// To avoid deadlocks due to stop the world, we just invalidate the executors but leave them to be freed
@@ -1777,9 +1777,9 @@ _Py_Executors_InvalidateAllLockHeld(PyInterpreterState *interp, int is_invalidat
17771777
void
17781778
_Py_Executors_InvalidateAll(PyInterpreterState *interp, int is_invalidation)
17791779
{
1780-
_PyEval_StopTheWorld(interp);
1780+
HEAD_LOCK(&_PyRuntime);
17811781
_Py_Executors_InvalidateAllLockHeld(interp, is_invalidation);
1782-
_PyEval_StartTheWorld(interp);
1782+
HEAD_UNLOCK(&_PyRuntime);
17831783
}
17841784

17851785
// Unlike _PyExecutor_InvalidateDependency, this is not for correctness but memory savings.

0 commit comments

Comments
 (0)