summaryrefslogtreecommitdiffstats
path: root/Lib/sqlite3
diff options
context:
space:
mode:
authorErlend Egeberg Aasland <erlend.aasland@innova.no>2021-06-24 14:35:57 (GMT)
committerGitHub <noreply@github.com>2021-06-24 14:35:57 (GMT)
commitb19f45533942e4ad7ddf9d2d94f8b87c6f746bce (patch)
treebec9f6276d7a24488de0614d64922c4314ffa8a4 /Lib/sqlite3
parent18ba1ff6a4eb284aefb8d157d5e574d8326a395d (diff)
downloadcpython-b19f45533942e4ad7ddf9d2d94f8b87c6f746bce.zip
cpython-b19f45533942e4ad7ddf9d2d94f8b87c6f746bce.tar.gz
cpython-b19f45533942e4ad7ddf9d2d94f8b87c6f746bce.tar.bz2
bpo-44491: Allow clearing the sqlite3 authoriser callback (GH-26863)
Diffstat (limited to 'Lib/sqlite3')
-rw-r--r--Lib/sqlite3/test/dbapi.py1
-rw-r--r--Lib/sqlite3/test/userfunctions.py6
2 files changed, 7 insertions, 0 deletions
diff --git a/Lib/sqlite3/test/dbapi.py b/Lib/sqlite3/test/dbapi.py
index 1a4b441..20cca33 100644
--- a/Lib/sqlite3/test/dbapi.py
+++ b/Lib/sqlite3/test/dbapi.py
@@ -652,6 +652,7 @@ class ThreadTests(unittest.TestCase):
lambda: self.con.rollback(),
lambda: self.con.close(),
lambda: self.con.set_trace_callback(None),
+ lambda: self.con.set_authorizer(None),
lambda: self.con.create_collation("foo", None),
]
for fn in fns:
diff --git a/Lib/sqlite3/test/userfunctions.py b/Lib/sqlite3/test/userfunctions.py
index dc900f6..1ed090e 100644
--- a/Lib/sqlite3/test/userfunctions.py
+++ b/Lib/sqlite3/test/userfunctions.py
@@ -522,6 +522,12 @@ class AuthorizerTests(unittest.TestCase):
self.con.execute("select c2 from t1")
self.assertIn('prohibited', str(cm.exception))
+ def test_clear_authorizer(self):
+ self.con.set_authorizer(None)
+ self.con.execute("select * from t2")
+ self.con.execute("select c2 from t1")
+
+
class AuthorizerRaiseExceptionTests(AuthorizerTests):
@staticmethod
def authorizer_cb(action, arg1, arg2, dbname, source):