]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-69093: Expose sqlite3.Blob as a class (GH-91550)
authorJelle Zijlstra <jelle.zijlstra@gmail.com>
Fri, 15 Apr 2022 13:29:57 +0000 (06:29 -0700)
committerGitHub <noreply@github.com>
Fri, 15 Apr 2022 13:29:57 +0000 (06:29 -0700)
I noticed this was missing while writing typeshed stubs. It's
useful to expose it for use in annotations and for exploration.

Lib/test/test_sqlite3/test_dbapi.py
Modules/_sqlite/module.c

index faaa3713cb5107e71915cc974d2394f9d66d6d6f..6613d5f0ea4bd51378952302593c404e2fbbda3c 100644 (file)
@@ -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)
index d355c2be37a2a53e9797ea587d196c1d409c828b..fbc57c7cc739eef132ec736fc6dd6f0b1f5bb397 100644 (file)
@@ -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);