mirror of
https://github.com/python/cpython.git
synced 2025-10-07 07:31:46 +00:00
gh-101766: Fix refleak for _BlockingOnManager resources from test suite level (gh-101988)
This commit is contained in:
parent
072011b3c3
commit
f482ade4c7
2 changed files with 5 additions and 5 deletions
|
@ -85,11 +85,6 @@ 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):
|
||||||
|
|
|
@ -33,6 +33,11 @@ class ModuleLockAsRLockTests:
|
||||||
test_repr = None
|
test_repr = None
|
||||||
test_locked_repr = None
|
test_locked_repr = None
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
for splitinit in init.values():
|
||||||
|
splitinit._bootstrap._blocking_on.clear()
|
||||||
|
|
||||||
|
|
||||||
LOCK_TYPES = {kind: splitinit._bootstrap._ModuleLock
|
LOCK_TYPES = {kind: splitinit._bootstrap._ModuleLock
|
||||||
for kind, splitinit in init.items()}
|
for kind, splitinit in init.items()}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue