Skip to content

Commit

Permalink
gh-69093: Don't allow instantiation of sqlite3.Blob objects (GH-91570)
Browse files Browse the repository at this point in the history
  • Loading branch information
Erlend Egeberg Aasland committed Apr 15, 2022
1 parent 7296598 commit d104f4d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions Lib/test/test_sqlite3/test_dbapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,7 @@ def test_shared_cache_deprecated(self):
def test_disallow_instantiation(self):
cx = sqlite.connect(":memory:")
check_disallow_instantiation(self, type(cx("select 1")))
check_disallow_instantiation(self, sqlite.Blob)

def test_complete_statement(self):
self.assertFalse(sqlite.complete_statement("select t"))
Expand Down
2 changes: 1 addition & 1 deletion Modules/_sqlite/blob.c
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ static PyType_Spec blob_spec = {
.name = MODULE_NAME ".Blob",
.basicsize = sizeof(pysqlite_Blob),
.flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC |
Py_TPFLAGS_IMMUTABLETYPE),
Py_TPFLAGS_IMMUTABLETYPE | Py_TPFLAGS_DISALLOW_INSTANTIATION),
.slots = blob_slots,
};

Expand Down

0 comments on commit d104f4d

Please sign in to comment.