Skip to content

Commit 19b86b3

Browse files
committed
changes for PR 106
1 parent 95b5bf6 commit 19b86b3

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/cs50/sql.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,11 @@ def connect(dbapi_connection, connection_record):
8989
finally:
9090
self._logger.disabled = disabled
9191

92+
def __del__(self):
93+
"""Close database connection."""
94+
if hasattr(self, "_connection"):
95+
self._connection.close()
96+
9297
@_enable_logging
9398
def execute(self, sql, *args, **kwargs):
9499
"""Execute a SQL statement."""

0 commit comments

Comments
 (0)