(self)
| 207 | """Helper for @asynccontextmanager decorator.""" |
| 208 | |
| 209 | async def __aenter__(self): |
| 210 | # do not keep args and kwds alive unnecessarily |
| 211 | # they are only needed for recreation, which is not possible anymore |
| 212 | del self.args, self.kwds, self.func |
| 213 | try: |
| 214 | return await anext(self.gen) |
| 215 | except StopAsyncIteration: |
| 216 | raise RuntimeError("generator didn't yield") from None |
| 217 | |
| 218 | async def __aexit__(self, typ, value, traceback): |
| 219 | if typ is None: |