This commit is contained in:
Kovid Goyal 2025-03-08 14:14:09 +05:30
parent 48f8bf55d8
commit 9bc711bd04
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -53,6 +53,7 @@ class Database:
def __exit__(self, exc_type, exc_value, tb) -> bool | None: def __exit__(self, exc_type, exc_value, tb) -> bool | None:
suppress_exception = self.conn.__exit__(exc_type, exc_value, tb) suppress_exception = self.conn.__exit__(exc_type, exc_value, tb)
self.conn.close()
if self.needs_copy and (suppress_exception or (exc_type is None and exc_value is None and tb is None)): if self.needs_copy and (suppress_exception or (exc_type is None and exc_value is None and tb is None)):
self.copy_db() self.copy_db()
return suppress_exception return suppress_exception