From: Jelle Zijlstra Date: Fri, 15 Apr 2022 13:29:57 +0000 (-0700) Subject: gh-69093: Expose sqlite3.Blob as a class (GH-91550) X-Git-Tag: v3.11.0b1~362 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b7f83bdd0e16f82288dc3557b7e715bb5c7d96d0;p=thirdparty%2FPython%2Fcpython.git gh-69093: Expose sqlite3.Blob as a class (GH-91550) I noticed this was missing while writing typeshed stubs. It's useful to expose it for use in annotations and for exploration. --- diff --git a/Lib/test/test_sqlite3/test_dbapi.py b/Lib/test/test_sqlite3/test_dbapi.py index faaa3713cb51..6613d5f0ea4b 100644 --- a/Lib/test/test_sqlite3/test_dbapi.py +++ b/Lib/test/test_sqlite3/test_dbapi.py @@ -1055,6 +1055,9 @@ class BlobTests(unittest.TestCase): 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 d355c2be37a2..fbc57c7cc739 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);