File tree Expand file tree Collapse file tree 2 files changed +6
-1
lines changed
Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Original file line number Diff line number Diff line change 2626import threading
2727import unittest
2828
29+ from test .support import check_disallow_instantiation
2930from test .support .os_helper import TESTFN , unlink
3031from test .support import threading_helper
3132
@@ -105,6 +106,10 @@ def test_shared_cache_deprecated(self):
105106 sqlite .enable_shared_cache (enable )
106107 self .assertIn ("dbapi.py" , cm .filename )
107108
109+ def test_disallow_instantiation (self ):
110+ cx = sqlite .connect (":memory:" )
111+ check_disallow_instantiation (self , type (cx ("select 1" )))
112+
108113
109114class ConnectionTests (unittest .TestCase ):
110115
Original file line number Diff line number Diff line change @@ -503,7 +503,7 @@ static PyType_Spec stmt_spec = {
503503 .name = MODULE_NAME ".Statement" ,
504504 .basicsize = sizeof (pysqlite_Statement ),
505505 .flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC |
506- Py_TPFLAGS_IMMUTABLETYPE ),
506+ Py_TPFLAGS_IMMUTABLETYPE | Py_TPFLAGS_DISALLOW_INSTANTIATION ),
507507 .slots = stmt_slots ,
508508};
509509
You can’t perform that action at this time.
0 commit comments