Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
gh-69093: Don't allow instantiation of sqlite3.Blob objects
  • Loading branch information
Erlend E. Aasland
Erlend E. Aasland committed Apr 15, 2022
commit 70ebe1593c74ded73b49e56a423d9bcc2344fef6
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