summaryrefslogtreecommitdiffstats
path: root/Lib/importlib/_bootstrap.py
diff options
context:
space:
mode:
authorsobolevn <mail@sobolevn.me>2025-04-08 08:14:12 (GMT)
committerGitHub <noreply@github.com>2025-04-08 08:14:12 (GMT)
commitf7305a06c7a322d23b39ad9d16af814d467624c6 (patch)
tree8a25dede6c059e01ae98c63d737ac0d0c1987b58 /Lib/importlib/_bootstrap.py
parent6cd1d6c6b142697fb72f422b7b448c27ebc30534 (diff)
downloadcpython-f7305a06c7a322d23b39ad9d16af814d467624c6.zip
cpython-f7305a06c7a322d23b39ad9d16af814d467624c6.tar.gz
cpython-f7305a06c7a322d23b39ad9d16af814d467624c6.tar.bz2
gh-115942: Add `locked` to several multiprocessing locks (#115944)
Co-authored-by: mpage <mpage@cs.stanford.edu> Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Diffstat (limited to 'Lib/importlib/_bootstrap.py')
-rw-r--r--Lib/importlib/_bootstrap.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/Lib/importlib/_bootstrap.py b/Lib/importlib/_bootstrap.py
index f563526..499da1e 100644
--- a/Lib/importlib/_bootstrap.py
+++ b/Lib/importlib/_bootstrap.py
@@ -382,6 +382,9 @@ class _ModuleLock:
self.waiters.pop()
self.wakeup.release()
+ def locked(self):
+ return bool(self.count)
+
def __repr__(self):
return f'_ModuleLock({self.name!r}) at {id(self)}'