This is an automated email from the ASF dual-hosted git repository.

lidavidm pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-adbc.git


The following commit(s) were added to refs/heads/main by this push:
     new e6c2e53  fix(python/adbc_driver_manager): fix uncaught exception in 
__del__ (#556)
e6c2e53 is described below

commit e6c2e530e28534c44d471ec78e1f6d32b4dd31ff
Author: David Li <[email protected]>
AuthorDate: Mon Mar 27 21:15:38 2023 -0400

    fix(python/adbc_driver_manager): fix uncaught exception in __del__ (#556)
---
 python/adbc_driver_manager/adbc_driver_manager/dbapi.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/python/adbc_driver_manager/adbc_driver_manager/dbapi.py 
b/python/adbc_driver_manager/adbc_driver_manager/dbapi.py
index 4e7e5ff..81aea3f 100644
--- a/python/adbc_driver_manager/adbc_driver_manager/dbapi.py
+++ b/python/adbc_driver_manager/adbc_driver_manager/dbapi.py
@@ -481,13 +481,16 @@ class Cursor(_Closeable):
     """
 
     def __init__(self, conn: Connection) -> None:
+        # Must be at top in case __init__ is interrupted and then __del__ is 
called
+        self._closed = True
         self._conn = conn
         self._stmt = _lib.AdbcStatement(conn._conn)
+        self._closed = False
+
         self._last_query: Optional[Union[str, bytes]] = None
         self._results: Optional["_RowIterator"] = None
         self._arraysize = 1
         self._rowcount = -1
-        self._closed = False
 
     @property
     def arraysize(self) -> int:

Reply via email to