From 15709f9dd0a7d8e7bc5c630f7fc3fc8b2e78c0f7 Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Thu, 14 Apr 2022 17:35:44 -0700 Subject: [PATCH] gh-69093: Expose sqlite3.Blob as a class I noticed this was missing while writing typeshed stubs. It's useful to expose it for use in annotations. --- Lib/test/test_sqlite3/test_dbapi.py | 3 +++ Modules/_sqlite/module.c | 1 + 2 files changed, 4 insertions(+) diff --git a/Lib/test/test_sqlite3/test_dbapi.py b/Lib/test/test_sqlite3/test_dbapi.py index faaa3713cb5107..6613d5f0ea4bd5 100644 --- a/Lib/test/test_sqlite3/test_dbapi.py +++ b/Lib/test/test_sqlite3/test_dbapi.py @@ -1055,6 +1055,9 @@ def tearDown(self): self.blob.close() self.cx.close() + def test_blob_is_a_blob(self): + self.assertIsInstance(self.blob, sqlite.Blob) + def test_blob_seek_and_tell(self): self.blob.seek(10) self.assertEqual(self.blob.tell(), 10) diff --git a/Modules/_sqlite/module.c b/Modules/_sqlite/module.c index d355c2be37a2a5..fbc57c7cc739ee 100644 --- a/Modules/_sqlite/module.c +++ b/Modules/_sqlite/module.c @@ -697,6 +697,7 @@ module_exec(PyObject *module) } pysqlite_state *state = pysqlite_get_state(module); + ADD_TYPE(module, state->BlobType); ADD_TYPE(module, state->ConnectionType); ADD_TYPE(module, state->CursorType); ADD_TYPE(module, state->PrepareProtocolType);