This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author graingert
Recipients Dima.Tisnek, asvetlov, graingert, lukasz.langa, ncoghlan, yselivanov
Date 2021-12-06.14:34:48
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1638801288.26.0.325599068166.issue45996@roundup.psfhosted.org>
In-reply-to
Content
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
```
History
Date User Action Args
2021-12-06 14:34:48graingertsetrecipients: + graingert, ncoghlan, asvetlov, lukasz.langa, Dima.Tisnek, yselivanov
2021-12-06 14:34:48graingertsetmessageid: <1638801288.26.0.325599068166.issue45996@roundup.psfhosted.org>
2021-12-06 14:34:48graingertlinkissue45996 messages
2021-12-06 14:34:48graingertcreate