Skip to content

Commit 1cd3d6c

Browse files
committed
Handle close better
The ensure_db check should have always done None check but the recent bool change caused closed connections to be resurrected on the same name
1 parent 9957d7d commit 1cd3d6c

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

apsw/shell.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ def _apply_fts(self):
179179

180180
def _ensure_db(self):
181181
"The database isn't opened until first use. This function ensures it is now open."
182-
if not self._db:
182+
if self._db is None:
183183
if not self.dbfilename:
184184
self.dbfilename = ":memory:"
185185
self._db = apsw.Connection(
@@ -1137,6 +1137,7 @@ def command_close(self, cmd):
11371137
"""
11381138
if len(cmd):
11391139
raise self.Error("Unexpected arguments")
1140+
self.db_references.discard(self.db)
11401141
self.db.close()
11411142

11421143
def command_connection(self, cmd):

0 commit comments

Comments
 (0)