Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrap async generators with contextlib.aclosing #159

Merged
merged 1 commit into from
Apr 16, 2024

Conversation

andylolz
Copy link
Contributor

@andylolz andylolz commented Apr 4, 2024

Fixes #158 – more details there.

It seems the aclosing context manager needs to be called for each nested async for loop. This PR does that.

Looks like #30 may have been due to the same problem – so this should resolve that, too.

@andylolz andylolz requested a review from vladkens as a code owner April 4, 2024 12:44
@vladkens
Copy link
Owner

Very much thanks for your contribution!

It's frustrating to wrap everything in aclosing.

@vladkens vladkens merged commit 9f34f03 into vladkens:main Apr 16, 2024
@andylolz
Copy link
Contributor Author

Many thanks for merging – and thanks again for the library!

@andylolz andylolz deleted the 158-aclosing-everywhere branch April 16, 2024 19:30
@vladkens vladkens added this to the v0.12 milestone Apr 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Wrapping API calls in contextlib.aclosing and breaking out of the generator loop doesn’t work as expected
2 participants