mirror of https://github.com/python/cpython
e2b340ab41
Currently, asyncio.wait_for(fut), upon reaching the timeout deadline, cancels the future and returns immediately. This is problematic for when *fut* is a Task, because it will be left running for an arbitrary amount of time. This behavior is iself surprising and may lead to related bugs such as the one described in bpo-33638: condition = asyncio.Condition() async with condition: await asyncio.wait_for(condition.wait(), timeout=0.5) Currently, instead of raising a TimeoutError, the above code will fail with `RuntimeError: cannot wait on un-acquired lock`, because `__aexit__` is reached _before_ `condition.wait()` finishes its cancellation and re-acquires the condition lock. To resolve this, make `wait_for` await for the task cancellation. The tradeoff here is that the `timeout` promise may be broken if the task decides to handle its cancellation in a slow way. This represents a behavior change and should probably not be back-patched to 3.6 and earlier. |
||
---|---|---|
.. | ||
__init__.py | ||
__main__.py | ||
echo.py | ||
echo2.py | ||
echo3.py | ||
functional.py | ||
keycert3.pem | ||
pycacert.pem | ||
ssl_cert.pem | ||
ssl_key.pem | ||
test_base_events.py | ||
test_buffered_proto.py | ||
test_context.py | ||
test_events.py | ||
test_futures.py | ||
test_locks.py | ||
test_pep492.py | ||
test_proactor_events.py | ||
test_queues.py | ||
test_runners.py | ||
test_selector_events.py | ||
test_server.py | ||
test_sslproto.py | ||
test_streams.py | ||
test_subprocess.py | ||
test_tasks.py | ||
test_transports.py | ||
test_unix_events.py | ||
test_windows_events.py | ||
test_windows_utils.py | ||
utils.py |