[3.10] bpo-44087: Disallow instantiation of sqlite3.Statement (GH-26567) (GH-26816)
Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@innova.no>
diff --git a/Lib/sqlite3/test/dbapi.py b/Lib/sqlite3/test/dbapi.py
index 39c9bf5..0716e65 100644
--- a/Lib/sqlite3/test/dbapi.py
+++ b/Lib/sqlite3/test/dbapi.py
@@ -92,6 +92,11 @@ def test_shared_cache_deprecated(self):
sqlite.enable_shared_cache(enable)
self.assertIn("dbapi.py", cm.filename)
+ def test_disallow_instantiation(self):
+ cx = sqlite.connect(":memory:")
+ tp = type(cx("select 1"))
+ self.assertRaises(TypeError, tp)
+
class ConnectionTests(unittest.TestCase):