Skip to content

Commit

Permalink
pythongh-101766: Fix refleak for _BlockingOnManager resources
Browse files Browse the repository at this point in the history
  • Loading branch information
corona10 committed Feb 14, 2023
1 parent eb0c485 commit 6ff177a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Lib/importlib/_bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ 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]


class _DeadlockError(RuntimeError):
Expand Down

0 comments on commit 6ff177a

Please sign in to comment.