File tree Expand file tree Collapse file tree 2 files changed +8
-0
lines changed
Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -233,6 +233,7 @@ def close(self) -> None:
233233 # Convert to list to avoid modification during iteration
234234 cursors_to_close = list (self ._cursors )
235235 close_errors = []
236+
236237 for cursor in cursors_to_close :
237238 try :
238239 if not cursor .closed :
@@ -268,6 +269,11 @@ def close(self) -> None:
268269 logger .info ("Connection closed successfully." )
269270
270271 def __del__ (self ):
272+ """
273+ Destructor to ensure the connection is closed when the connection object is no longer needed.
274+ This is a safety net to ensure resources are cleaned up
275+ even if close() was not called explicitly.
276+ """
271277 if not self ._closed :
272278 try :
273279 self .close ()
Original file line number Diff line number Diff line change @@ -744,6 +744,8 @@ def nextset(self) -> Union[bool, None]:
744744 def __del__ (self ):
745745 """
746746 Destructor to ensure the cursor is closed when it is no longer needed.
747+ This is a safety net to ensure resources are cleaned up
748+ even if close() was not called explicitly.
747749 """
748750 if not self .closed :
749751 try :
You can’t perform that action at this time.
0 commit comments