[issue40607] asyncio.wait_for should reraise future exception even if timeout expires

2020-05-18 Thread Chris Jerdonek


Chris Jerdonek  added the comment:

Thank you again, Roman and all.

--
resolution:  -> fixed
stage: patch review -> resolved
status: open -> closed
versions: +Python 3.9 -Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40607] asyncio.wait_for should reraise future exception even if timeout expires

2020-05-15 Thread Yury Selivanov


Yury Selivanov  added the comment:


New changeset 382a5635bd10c237c3e23e346b21cde27e48d7fa by romasku in branch 
'master':
bpo-40607: Reraise exception during task cancelation in asyncio.wait_for() 
(GH-20054)
https://github.com/python/cpython/commit/382a5635bd10c237c3e23e346b21cde27e48d7fa


--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40607] asyncio.wait_for should reraise future exception even if timeout expires

2020-05-13 Thread Yury Selivanov


Yury Selivanov  added the comment:

> I think that in case inner task cancelation fails with some error, 
> asyncio.wait_for should reraise it instead of silently losing it.

+1.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40607] asyncio.wait_for should reraise future exception even if timeout expires

2020-05-12 Thread Nathaniel Smith


Nathaniel Smith  added the comment:

makes sense to me

On Tue, May 12, 2020 at 10:14 PM Chris Jerdonek  wrote:
>
>
> Chris Jerdonek  added the comment:
>
> Also adding Nathaniel since he's the one that filed #32751. Nathaniel, do you 
> agree that if an exception occurs while waiting for the cancellation, the 
> exception should be what's raised instead of TimeoutError?
>
> --
> nosy: +chris.jerdonek, njs
>
> ___
> Python tracker 
> 
> ___

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40607] asyncio.wait_for should reraise future exception even if timeout expires

2020-05-12 Thread Chris Jerdonek


Chris Jerdonek  added the comment:

Also adding Nathaniel since he's the one that filed #32751. Nathaniel, do you 
agree that if an exception occurs while waiting for the cancellation, the 
exception should be what's raised instead of TimeoutError?

--
nosy: +chris.jerdonek, njs

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40607] asyncio.wait_for should reraise future exception even if timeout expires

2020-05-12 Thread Roundup Robot


Change by Roundup Robot :


--
keywords: +patch
nosy: +python-dev
nosy_count: 3.0 -> 4.0
pull_requests: +19363
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/20054

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40607] asyncio.wait_for should reraise future exception even if timeout expires

2020-05-12 Thread Roman Skurikhin


New submission from Roman Skurikhin :

In https://bugs.python.org/issue32751 asyncio.wait_for behaviour was changed 
that when we use timeout=... and the timeout expires, it waits until task is 
canceled. However, in some cases inner task can trigger exception while it 
handles cancellation. Check the following code:


import asyncio


async def ignore_cancel_and_raise():
try:
await asyncio.sleep(20)
except asyncio.CancelledError:
raise Exception('Cancellation failed')


async def main():
try:
await asyncio.wait_for(ignore_cancel_and_raise(), timeout=1)
except asyncio.TimeoutError:
print('Timeout')

asyncio.run(main())


It will print "Timeout" and log a warning that "Task exception was never 
retrieved".

I think that in case inner task cancelation fails with some error, 
asyncio.wait_for should reraise it instead of silently losing it.

--
components: asyncio
messages: 368723
nosy: Roman Skurikhin, asvetlov, yselivanov
priority: normal
severity: normal
status: open
title: asyncio.wait_for should reraise future exception even if timeout expires
type: behavior
versions: Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com