[issue45996] Worse error from asynccontextmanager in Python 3.10
Thomas Grainger
report at bugs.python.org
Mon Dec 6 09:19:07 EST 2021
Thomas Grainger <tagrain at gmail.com> 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()
n.start_soon(f.__aenter__)
n.start_soon(f.__aenter__)
trio.run(test)
```
```
Traceback (most recent call last):
File "/home/graingert/projects/examples/bar.py", line 17, in <module>
trio.run(test)
File "/home/graingert/.virtualenvs/testing39/lib/python3.9/site-packages/trio/_core/_run.py", line 1932, in run
raise runner.main_task_outcome.error
File "/home/graingert/projects/examples/bar.py", line 15, in test
n.start_soon(f.__aenter__)
File "/home/graingert/.virtualenvs/testing39/lib/python3.9/site-packages/trio/_core/_run.py", line 815, in __aexit__
raise combined_error_from_nursery
File "/usr/lib/python3.9/contextlib.py", line 179, in __aenter__
del self.args, self.kwds, self.func
AttributeError: args
```
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue45996>
_______________________________________
More information about the Python-bugs-list
mailing list