Skip to content

Commit

Permalink
gh-101766: Fix refleak for _BlockingOnManager resources (gh-101942)
Browse files Browse the repository at this point in the history
  • Loading branch information
corona10 authored Feb 17, 2023
1 parent 3c0a31c commit 775f881
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Lib/importlib/_bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ def __enter__(self):
def __exit__(self, *args, **kwargs):
"""Remove self.lock from this thread's _blocking_on list."""
self.blocked_on.remove(self.lock)
if len(self.blocked_on) == 0:
# gh-101766: glboal cache should be cleaned-up
# if there is no more _blocking_on for this thread.
del _blocking_on[self.thread_id]
del self.blocked_on


class _DeadlockError(RuntimeError):
Expand Down

0 comments on commit 775f881

Please sign in to comment.