Skip to content

Commit 70ebe15

Browse files
author
Erlend E. Aasland
committed
pythongh-69093: Don't allow instantiation of sqlite3.Blob objects
1 parent 7296598 commit 70ebe15

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

Lib/test/test_sqlite3/test_dbapi.py

+1
Original file line numberDiff line numberDiff line change
@@ -356,6 +356,7 @@ def test_shared_cache_deprecated(self):
356356
def test_disallow_instantiation(self):
357357
cx = sqlite.connect(":memory:")
358358
check_disallow_instantiation(self, type(cx("select 1")))
359+
check_disallow_instantiation(self, sqlite.Blob)
359360

360361
def test_complete_statement(self):
361362
self.assertFalse(sqlite.complete_statement("select t"))

Modules/_sqlite/blob.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ static PyType_Spec blob_spec = {
334334
.name = MODULE_NAME ".Blob",
335335
.basicsize = sizeof(pysqlite_Blob),
336336
.flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC |
337-
Py_TPFLAGS_IMMUTABLETYPE),
337+
Py_TPFLAGS_IMMUTABLETYPE | Py_TPFLAGS_DISALLOW_INSTANTIATION),
338338
.slots = blob_slots,
339339
};
340340

0 commit comments

Comments
 (0)