asyncpg icon indicating copy to clipboard operation
asyncpg copied to clipboard

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

Open vkcku opened this issue 2 years ago • 2 comments

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.

vkcku avatar Nov 16 '23 05:11 vkcku

+1 @elprans

rudcode avatar Feb 07 '24 05:02 rudcode

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).

bryanforbes avatar Feb 15 '24 19:02 bryanforbes

Thanks!

elprans avatar Jul 17 '24 21:07 elprans