mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
gh-101766: Fix refleak for _BlockingOnManager resources (gh-101942)
This commit is contained in:
parent
3c0a31cbfd
commit
775f8819e3
1 changed files with 5 additions and 0 deletions
|
@ -85,6 +85,11 @@ class _BlockingOnManager:
|
||||||
def __exit__(self, *args, **kwargs):
|
def __exit__(self, *args, **kwargs):
|
||||||
"""Remove self.lock from this thread's _blocking_on list."""
|
"""Remove self.lock from this thread's _blocking_on list."""
|
||||||
self.blocked_on.remove(self.lock)
|
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):
|
class _DeadlockError(RuntimeError):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue