asyncpg
asyncpg copied to clipboard
fix: return the pool from _async_init__ if it's already initialized
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.
+1 @elprans
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).
Thanks!