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 26
26
import threading
27
27
import unittest
28
28
29
+ from test .support import check_disallow_instantiation
29
30
from test .support .os_helper import TESTFN , unlink
30
31
from test .support import threading_helper
31
32
@@ -105,6 +106,10 @@ def test_shared_cache_deprecated(self):
105
106
sqlite .enable_shared_cache (enable )
106
107
self .assertIn ("dbapi.py" , cm .filename )
107
108
109
+ def test_disallow_instantiation (self ):
110
+ cx = sqlite .connect (":memory:" )
111
+ check_disallow_instantiation (self , type (cx ("select 1" )))
112
+
108
113
109
114
class ConnectionTests (unittest .TestCase ):
110
115
Original file line number Diff line number Diff line change @@ -503,7 +503,7 @@ static PyType_Spec stmt_spec = {
503
503
.name = MODULE_NAME ".Statement" ,
504
504
.basicsize = sizeof (pysqlite_Statement ),
505
505
.flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC |
506
- Py_TPFLAGS_IMMUTABLETYPE ),
506
+ Py_TPFLAGS_IMMUTABLETYPE | Py_TPFLAGS_DISALLOW_INSTANTIATION ),
507
507
.slots = stmt_slots ,
508
508
};
509
509
You can’t perform that action at this time.
0 commit comments