mirror of
https://github.com/python/cpython.git
synced 2025-09-26 10:19:53 +00:00
bpo-40607: Reraise exception during task cancelation in asyncio.wait_for() (GH-20054)
Currently, if asyncio.wait_for() timeout expires, it cancels inner future and then always raises TimeoutError. In case those future is task, it can handle cancelation mannually, and those process can lead to some other exception. Current implementation silently loses thoses exception. To resolve this, wait_for will check was the cancelation successfull or not. In case there was exception, wait_for will reraise it. Co-authored-by: Roman Skurikhin <roman.skurikhin@cruxlab.com>
This commit is contained in:
parent
c087a268a4
commit
382a5635bd
5 changed files with 66 additions and 6 deletions
|
@ -453,7 +453,8 @@ Timeouts
|
|||
wrap it in :func:`shield`.
|
||||
|
||||
The function will wait until the future is actually cancelled,
|
||||
so the total wait time may exceed the *timeout*.
|
||||
so the total wait time may exceed the *timeout*. If an exception
|
||||
happens during cancellation, it is propagated.
|
||||
|
||||
If the wait is cancelled, the future *aw* is also cancelled.
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue