Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions 5 Lib/sqlite3/test/dbapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import threading
import unittest

from test.support import check_disallow_instantiation
from test.support.os_helper import TESTFN, unlink


Expand Down Expand Up @@ -104,6 +105,10 @@ 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:")
check_disallow_instantiation(self, type(cx("select 1")))


class ConnectionTests(unittest.TestCase):

Expand Down
2 changes: 1 addition & 1 deletion 2 Modules/_sqlite/statement.c
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ static PyType_Spec stmt_spec = {
.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,
};

Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.