Closed gsalgado closed 4 years ago
Both approaches adhere to the context manager protocol, since both returns test as false. Are you running into an issue where the difference is relevant to your application?
It looks like the synchronous @contextlib.contextmanager
returns False in this case, which is where async_generator
got its behavior from. And @contextlib.asynccontextmanager
returns False in some cases and None in others. I think the stdlib @asynccontextmanager
is the odd one out here.
Not really relevant to my application, but I was writing some tests that checked for the yielded values and noticed the discrepancy so I thought maybe it was worth reporting. Feel free to ~ignore~close if you think it has no practical implications
If it's not causing any problems then let's let it be. We can always re-open if it somehow starts causing problems in the future :-)
I don't know if this is intentional, but contextlib's
asynccontextmanager
decorated functions return None whereas here they'd return False. The snippet below shows that: