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

fix: return the pool from _async_init__ if it's already initialized #1104

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

guacs
Copy link

@guacs guacs commented Nov 16, 2023

In situations where the pool is awaited multiple times, None is returned after the initial await. To fix this, the pool is returned from _async_init__ when the pool is already initialized and not just after the first initialization.

@rudcode
Copy link

rudcode commented Feb 7, 2024

+1 @elprans

@bryanforbes
Copy link
Collaborator

bryanforbes commented Feb 15, 2024

This change would definitely be a welcome improvement on the typing front as I currently have to type Pool.__await__ as producing Pool | None which affects the return value of await asyncpg.create_pool() even though create_pool() will never produce an initialized Pool (see bryanforbes/asyncpg-stubs#120).

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.

None yet

3 participants