Visitar URL original
bpo-31746: Fixed Segfaults in the sqlite module when uninitialized. by lielfr · Pull Request #3946 · python/cpython · GitHub
Skip to content
Closed
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
The first example code doesn't crash anymore.
  • Loading branch information
lielfr committed Apr 28, 2021
commit c0920c84142e04b7eb67049d287ca51b239792de
6 changes: 6 additions & 0 deletions Modules/_sqlite/connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,12 @@ static PyObject *
pysqlite_connection_cursor_impl(pysqlite_Connection *self, PyObject *factory)
/*[clinic end generated code: output=562432a9e6af2aa1 input=4127345aa091b650]*/
{
if (self == NULL) {
return NULL;
}

static char *kwlist[] = {"factory", NULL};
Comment on lines +299 to +303

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not needed if self->initialized is only set if pysqlite_connection_init was successful. Also, it looks like the rebase left some artifacts :)

PyObject* factory = NULL;
PyObject* cursor;

if (!pysqlite_check_thread(self) || !pysqlite_check_connection(self)) {
Expand Down