Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
Changes
-------
0.5.1 (unreleased)
^^^^^^^^^^^^^^^^^
* Ensure close() runs even if rollback() fails (fix #471)

0.5.0 (2023-10-28)
^^^^^^^^^^^^^^^^^^
* Added support for python 3.12
Expand Down
12 changes: 8 additions & 4 deletions aioodbc/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@ async def _close_cursor(c: Cursor) -> None:


async def _close_cursor_on_error(c: Cursor) -> None:
await c.rollback()
await c.close()
try:
await c.rollback()
finally:
await c.close()


class Connection:
Expand Down Expand Up @@ -248,8 +250,10 @@ async def _disconnect(c: "Connection") -> None:


async def _disconnect_on_error(c: "Connection") -> None:
await c.rollback()
await c.close()
try:
await c.rollback()
finally:
await c.close()


async def _connect(
Expand Down