Skip to content

Commit f63d130

Browse files
committed
Update Semaphore.locked.
`Semaphore` docstring says the counter can never go below zero.
1 parent a90aa69 commit f63d130

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Lib/asyncio/locks.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -357,8 +357,8 @@ def __repr__(self):
357357
return f'<{res[1:-1]} [{extra}]>'
358358

359359
def locked(self):
360-
"""Returns True if semaphore can not be acquired immediately."""
361-
return self._value <= 0
360+
"""Returns True if semaphore counter is zero."""
361+
return self._value == 0
362362

363363
async def acquire(self):
364364
"""Acquire a semaphore.

0 commit comments

Comments
 (0)