Closed
Description
Documentation
In this example for using asyncio.Timeout
, expired
is accessed as an attribute, but it should be called as a method.
I.e. the example should read as:
async def main():
try:
# We do not know the timeout when starting, so we pass ``None``.
async with asyncio.timeout(None) as cm:
# We know the timeout now, so we reschedule it.
new_deadline = get_running_loop().time() + 10
cm.reschedule(new_deadline)
await long_running_task()
except TimeoutError:
pass
if cm.expired(): # <---- I CHANGED THIS TO BE A METHOD CALL
print("Looks like we haven't finished on time.")
Linked PRs
Metadata
Metadata
Assignees
Projects
Status
Done