Skip to content

Commit 4ebb593

Browse files
author
Erlend E. Aasland
committed
sqlite3_close_v2() always returns SQLITE_OK
1 parent e0ffe76 commit 4ebb593

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

Modules/_sqlite/connection.c

+5-12
Original file line numberDiff line numberDiff line change
@@ -250,17 +250,14 @@ connection_clear(pysqlite_Connection *self)
250250
return 0;
251251
}
252252

253-
static int
253+
static void
254254
connection_close(pysqlite_Connection *self)
255255
{
256-
int rc = SQLITE_OK;
257-
258256
if (self->db) {
259-
rc = sqlite3_close_v2(self->db);
257+
int rc = sqlite3_close_v2(self->db);
258+
assert(rc == SQLITE_OK);
260259
self->db = NULL;
261260
}
262-
263-
return rc;
264261
}
265262

266263
static void
@@ -271,7 +268,7 @@ connection_dealloc(pysqlite_Connection *self)
271268
tp->tp_clear((PyObject *)self);
272269

273270
/* Clean up if user has not called .close() explicitly. */
274-
(void)connection_close(self);
271+
connection_close(self);
275272

276273
tp->tp_free(self);
277274
Py_DECREF(tp);
@@ -367,11 +364,7 @@ pysqlite_connection_close_impl(pysqlite_Connection *self)
367364
Py_CLEAR(self->statements);
368365
Py_CLEAR(self->cursors);
369366

370-
int rc = connection_close(self);
371-
if (rc != SQLITE_OK) {
372-
_pysqlite_seterror(self->db);
373-
return NULL;
374-
}
367+
connection_close(self);
375368
}
376369

377370
Py_RETURN_NONE;

0 commit comments

Comments
 (0)