Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@innova.no>
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):
.name = MODULE_NAME ".Statement",
.basicsize = sizeof(pysqlite_Statement),
.flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC |
- Py_TPFLAGS_IMMUTABLETYPE),
+ Py_TPFLAGS_IMMUTABLETYPE | Py_TPFLAGS_DISALLOW_INSTANTIATION),
.slots = stmt_slots,
};
PyTypeObject *pysqlite_StatementType = NULL;