[issue35409] Async generator might re-throw GeneratorExit on aclose()

2020-08-29 Thread Spencer Baugh


Spencer Baugh  added the comment:

My mistake, I see now this is just https://bugs.python.org/issue33786 and is 
already fixed.

--

___
Python tracker 

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



[issue35409] Async generator might re-throw GeneratorExit on aclose()

2020-08-29 Thread Spencer Baugh


Spencer Baugh  added the comment:

I'm not sure this was the correct fix - or at least, this creates further 
issues with asynccontextmanager. Consider the following code:

---
import contextlib
import types

@contextlib.asynccontextmanager
async def acm():
# GeneratorExit athrown here from AsyncContextManager __aexit__,
# propagated from the body of the contextmanager in func()
yield

@types.coroutine
def _yield():
yield

async def func():
async with acm():
# GeneratorExit raised here
await _yield()

x = func()
x.send(None) # start running func
x.close() # raise GeneratorExit in func at its current yield
# AsyncContextManager __aexit__ fails with "RuntimeError: generator didn't stop 
after throw()"
---

The reason for the failure in AsyncContextManager __aexit__ is that the 
asyncgenerator raises StopIteration instead of GeneratorExit when 
agen.athrow(GeneratorExit()) is called and driven, so "await 
agen.athrow(GeneratorExit())" just evaluates to None, rather than raising 
GeneratorExit.

On 3.6 this would work fine, because "await athrow(GeneratorExit())" will raise 
GeneratorExit. I suspect this was broken by this change.

--
nosy: +catern

___
Python tracker 

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



[issue35409] Async generator might re-throw GeneratorExit on aclose()

2020-05-23 Thread Roman Evstifeev


Change by Roman Evstifeev :


--
nosy: +Roman.Evstifeev

___
Python tracker 

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



[issue35409] Async generator might re-throw GeneratorExit on aclose()

2019-11-19 Thread miss-islington


miss-islington  added the comment:


New changeset 6c3b471c8c0bfd49c664d8ee7e95da3710fd6069 by Miss Islington (bot) 
in branch '3.8':
bpo-35409: Ignore GeneratorExit in async_gen_athrow_throw (GH-14755)
https://github.com/python/cpython/commit/6c3b471c8c0bfd49c664d8ee7e95da3710fd6069


--

___
Python tracker 

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



[issue35409] Async generator might re-throw GeneratorExit on aclose()

2019-11-19 Thread miss-islington


miss-islington  added the comment:


New changeset 4ffc569b47bef9f95e443f3c56f7e7e32cb440c0 by Miss Islington (bot) 
in branch '3.7':
bpo-35409: Ignore GeneratorExit in async_gen_athrow_throw (GH-14755)
https://github.com/python/cpython/commit/4ffc569b47bef9f95e443f3c56f7e7e32cb440c0


--

___
Python tracker 

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



[issue35409] Async generator might re-throw GeneratorExit on aclose()

2019-11-19 Thread Andrew Svetlov


Change by Andrew Svetlov :


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

___
Python tracker 

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



[issue35409] Async generator might re-throw GeneratorExit on aclose()

2019-11-19 Thread miss-islington


Change by miss-islington :


--
pull_requests: +16751
pull_request: https://github.com/python/cpython/pull/17257

___
Python tracker 

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



[issue35409] Async generator might re-throw GeneratorExit on aclose()

2019-11-19 Thread miss-islington


Change by miss-islington :


--
pull_requests: +16752
pull_request: https://github.com/python/cpython/pull/17258

___
Python tracker 

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



[issue35409] Async generator might re-throw GeneratorExit on aclose()

2019-11-19 Thread miss-islington


miss-islington  added the comment:


New changeset 8e0de2a4808d7c2f4adedabff89ee64e0338790a by Miss Islington (bot) 
(Vincent Michel) in branch 'master':
bpo-35409: Ignore GeneratorExit in async_gen_athrow_throw (GH-14755)
https://github.com/python/cpython/commit/8e0de2a4808d7c2f4adedabff89ee64e0338790a


--
nosy: +miss-islington

___
Python tracker 

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



[issue35409] Async generator might re-throw GeneratorExit on aclose()

2019-07-13 Thread Vincent Michel


Change by Vincent Michel :


--
pull_requests: +14550
stage:  -> patch review
pull_request: https://github.com/python/cpython/pull/14755

___
Python tracker 

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



[issue35409] Async generator might re-throw GeneratorExit on aclose()

2018-12-04 Thread Vincent Michel


Change by Vincent Michel :


--
keywords: +patch
Added file: https://bugs.python.org/file47974/patch.diff

___
Python tracker 

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



[issue35409] Async generator might re-throw GeneratorExit on aclose()

2018-12-04 Thread Vincent Michel


Change by Vincent Michel :


Added file: https://bugs.python.org/file47973/test.py

___
Python tracker 

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



[issue35409] Async generator might re-throw GeneratorExit on aclose()

2018-12-04 Thread Vincent Michel


New submission from Vincent Michel :

As far as I can tell, this issue is different than: 
https://bugs.python.org/issue34730

I noticed `async_gen.aclose()` raises a GeneratorExit exception if the async 
generator finalization awaits and silence a failing unfinished future (see 
example.py).

This seems to be related to a bug in `async_gen_athrow_throw`. In fact, 
`async_gen.aclose().throw(exc)` does not silence GeneratorExit exceptions. This 
behavior can be reproduced without asyncio (see test.py).

Attached is a possible patch, although I'm not too comfortable messing with the 
python C internals. I can make a PR if necessary.

--
components: Interpreter Core
files: example.py
messages: 331043
nosy: vxgmichel
priority: normal
severity: normal
status: open
title: Async generator might re-throw GeneratorExit on aclose()
type: behavior
versions: Python 3.6, Python 3.7, Python 3.8
Added file: https://bugs.python.org/file47972/example.py

___
Python tracker 

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