8000 gh-101766: Fix refleak for _BlockingOnManager resources · python/cpython@6ff177a · GitHub
[go: up one dir, main page]

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 6ff177a

Browse files
committed
gh-101766: Fix refleak for _BlockingOnManager resources
1 parent eb0c485 commit 6ff177a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Lib/importlib/_bootstrap.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,10 @@ 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 len(self.blocked_on) == 0:
89+
# gh-101766: glboal cache should be cleaned-up
90+
# if there is no more _blocking_on for this thread.
91+
del _blocking_on[self.thread_id]
8892

8993

9094
class _DeadlockError(RuntimeError):

0 commit comments

Comments
 (0)
0