Skip to content

Commit 5328e32

Browse files
committed
gh-106176: Fix reference leak in importlib/_bootstrap.py
1 parent a3dd8cc commit 5328e32

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

Lib/importlib/_bootstrap.py

+2
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ def __enter__(self):
8585
def __exit__(self, *args, **kwargs):
8686
"""Remove self.lock from this thread's _blocking_on list."""
8787
self.blocked_on.remove(self.lock)
88+
if not self.blocked_on:
89+
del _blocking_on[self.thread_id]
8890

8991

9092
class _DeadlockError(RuntimeError):

0 commit comments

Comments
 (0)