[issue45996] Worse error from asynccontextmanager in Python 3.10

2021-12-20 Thread Andrew Svetlov
Andrew Svetlov added the comment: Sorry, I closed it because async behavior reflects sync version now. If you want to improve both -- you are welcome! Perhaps it is worth another issue with another problem description. -- resolution: fixed -> wont fix ___

[issue45996] Worse error from asynccontextmanager in Python 3.10

2021-12-19 Thread Dima Tisnek
Dima Tisnek added the comment: I'm fine with guarding both. -- ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe

[issue45996] Worse error from asynccontextmanager in Python 3.10

2021-12-19 Thread Thomas Grainger
Thomas Grainger added the comment: > Actually I don't agree with Thomas's logic... his argument feels like > consistency for its own sake. Do you expect sync and async contextmanagers to act differently? Why would sync contextmanagers raise AttributeError and async contextmanagers raise a R

[issue45996] Worse error from asynccontextmanager in Python 3.10

2021-12-19 Thread Dima Tisnek
Dima Tisnek added the comment: Andrew, I see that you've closed this issue as "fixed". I'm a little confused by that. If you mean that 3.10 behaviour is better than 3.9, than perhaps "not a bug / rejected / wont fix" would make more sense. Actually I don't agree with Thomas's logic... his a

[issue45996] Worse error from asynccontextmanager in Python 3.10

2021-12-19 Thread Andrew Svetlov
Change by Andrew Svetlov : -- resolution: -> fixed stage: -> resolved status: open -> closed ___ Python tracker ___ ___ Python-bug

[issue45996] Worse error from asynccontextmanager in Python 3.10

2021-12-06 Thread Thomas Grainger
Thomas Grainger added the comment: you can see the analogous sync contextmanager issue on python3.6 with: ``` import logging from contextlib import contextmanager @contextmanager def foo(): yield def test(): f = foo() f.__enter__() f.__enter__() test() ``` on python3.7+ yo

[issue45996] Worse error from asynccontextmanager in Python 3.10

2021-12-06 Thread Thomas Grainger
Thomas Grainger added the comment: I see the change here: https://github.com/python/cpython/commit/1c5c9c89ffc36875afaf4c3cc6a716d4bd089bbf#diff-e00601a380ba6c916ba4333277fe6ea43d2477804002ab1ae64480f80fec8e3aR177-R179 this is intentionally implementing https://bugs.python.org/issue30306 for

[issue45996] Worse error from asynccontextmanager in Python 3.10

2021-12-06 Thread Thomas Grainger
Thomas Grainger added the comment: ah I can repeat this on python3.8.10 trio but not python3.9.9 trio: ``` import logging import trio from contextlib import asynccontextmanager @asynccontextmanager async def foo(): await trio.sleep(1) yield async def test(): async with trio.open

[issue45996] Worse error from asynccontextmanager in Python 3.10

2021-12-06 Thread Thomas Grainger
Thomas Grainger added the comment: or consider the trio version: ``` import logging import trio from contextlib import asynccontextmanager @asynccontextmanager async def foo(): await trio.sleep(1) yield async def test(): async with trio.open_nursery() as n: f = foo()

[issue45996] Worse error from asynccontextmanager in Python 3.10

2021-12-06 Thread Thomas Grainger
Thomas Grainger added the comment: I think `AttributeError: args` is the desired/expected behaviour consider the sync version: ``` import logging from asyncio import sleep, gather, run from contextlib import asynccontextmanager, contextmanager @contextmanager def foo(): yield def test(

[issue45996] Worse error from asynccontextmanager in Python 3.10

2021-12-06 Thread Serhiy Storchaka
Change by Serhiy Storchaka : -- nosy: +graingert, lukasz.langa, ncoghlan ___ Python tracker ___ ___ Python-bugs-list mailing list Un

[issue45996] Worse error from asynccontextmanager in Python 3.10

2021-12-06 Thread Dima Tisnek
New submission from Dima Tisnek : Consider this illegal code: import logging from asyncio import sleep, gather, run from contextlib import asynccontextmanager @asynccontextmanager async def foo(): await sleep(1) yield async def test(): f = foo() await gather(f.__aenter__(),