]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commit
shield connection close in terminate 12076/head
authorJean Raby <jean@raby.sh>
Sun, 10 Nov 2024 12:06:57 +0000 (07:06 -0500)
committerJean Raby <jean@raby.sh>
Fri, 15 Nov 2024 13:35:42 +0000 (08:35 -0500)
commit6ae261ea7668f4c850874666efec6fef658b08c0
tree360bad86cc71fa02a2a5eacc165058a39d94941b
parentef23611a6bf8358dd05e0fc13384f1eb1925e1ff
shield connection close in terminate

If terminate is called from an asyncio.CancelledError exception handler,
under an anyio task group, await will bail with asyncio.CancelledError
right away, leading to a connection leak.

Shielding the close() call allows the connection to be properly closed
in those cases.
lib/sqlalchemy/dialects/postgresql/asyncpg.py