Thomas Grainger <[email protected]> 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+ you get the bpo-30306 behaviour
```
Traceback (most recent call last):
File "sync.py", line 14, in <module>
test()
File "sync.py", line 12, in test
f.__enter__()
File "/usr/lib/python3.8/contextlib.py", line 111, in __enter__
del self.args, self.kwds, self.func
AttributeError: args
```
and python3.6 you get the same sort of error you see now for
asynccontextmanagers:
```
Traceback (most recent call last):
File "sync.py", line 14, in <module>
test()
File "sync.py", line 12, in test
f.__enter__()
File "/usr/lib/python3.6/contextlib.py", line 83, in __enter__
raise RuntimeError("generator didn't yield") from None
RuntimeError: generator didn't yield
```
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue45996>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com