8000 gh-108083: Don't ignore exceptions in sqlite3.Connection.__init__() and .close() by erlend-aasland · Pull Request #108084 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-108083: Don't ignore exceptions in sqlite3.Connection.__init__() and .close() #108084

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Make sure we're not initialized if reinit fails
  • Loading branch information
erlend-aasland committed Aug 18, 2023
commit 0d4eb8bd6be18f45ed7e3d750a24dc578227460d
3 changes: 2 additions & 1 deletion Modules/_sqlite/connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -247,12 +247,13 @@ pysqlite_connection_init_impl(pysqlite_Connection *self, PyObject *database,
}

if (self->initialized) {
self->initialized = 0;

PyTypeObject *tp = Py_TYPE(self);
tp->tp_clear((PyObject *)self);
if (connection_close(self) < 0) {
return -1;
}
self->initialized = 0;
}

// Create and configure SQLite database object.
Expand Down
0