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 25
25
import sqlite3 as sqlite
26
26
import sys
27
27
28
+ from test .support import check_disallow_instantiation
28
29
from test .support .os_helper import TESTFN , unlink
29
30
30
31
@@ -92,6 +93,10 @@ def test_shared_cache_deprecated(self):
92
93
sqlite .enable_shared_cache (enable )
93
94
self .assertIn ("dbapi.py" , cm .filename )
94
95
96
+ def test_disallow_instantiation (self ):
97
+ cx = sqlite .connect (":memory:" )
98
+ check_disallow_instantiation (self , type (cx ("select 1" )))
99
+
95
100
96
101
class ConnectionTests (unittest .TestCase ):
97
102
Original file line number Diff line number Diff line change @@ -509,7 +509,7 @@ static PyType_Spec stmt_spec = {
509
509
.name = MODULE_NAME ".Statement" ,
510
510
.basicsize = sizeof (pysqlite_Statement ),
511
511
.flags = (Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC |
512
- Py_TPFLAGS_IMMUTABLETYPE ),
512
+ Py_TPFLAGS_IMMUTABLETYPE | Py_TPFLAGS_DISALLOW_INSTANTIATION ),
513
513
.slots = stmt_slots ,
514
514
};
515
515
PyTypeObject * pysqlite_StatementType = NULL ;
You can’t perform that action at this time.
0 commit comments