summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorErlend Egeberg Aasland <erlend.aasland@protonmail.com>2022-05-16 17:52:08 (GMT)
committerGitHub <noreply@github.com>2022-05-16 17:52:08 (GMT)
commit00f22e8cc234aa52ec1f28094a170d7b87d0d08f (patch)
treea59310dd786b5de47629857f039bff45ee4c2232 /Lib
parent9b50585e0225a80f9e383edacc7d73f1b5c8008b (diff)
downloadcpython-00f22e8cc234aa52ec1f28094a170d7b87d0d08f.zip
cpython-00f22e8cc234aa52ec1f28094a170d7b87d0d08f.tar.gz
cpython-00f22e8cc234aa52ec1f28094a170d7b87d0d08f.tar.bz2
gh-92547: Remove deprecated sqlite3 features (#92548)
The following sqlite3 features were deprecated in 3.10, scheduled for removal in 3.12: - sqlite3.OptimizedUnicode (gh-23163) - sqlite3.enable_shared_cache (gh-24008) Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com> Signed-off-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
Diffstat (limited to 'Lib')
-rw-r--r--Lib/sqlite3/__init__.py14
-rw-r--r--Lib/sqlite3/dbapi2.py14
-rw-r--r--Lib/test/test_sqlite3/test_dbapi.py9
-rw-r--r--Lib/test/test_sqlite3/test_factory.py12
4 files changed, 0 insertions, 49 deletions
diff --git a/Lib/sqlite3/__init__.py b/Lib/sqlite3/__init__.py
index 5a2dbd3..34a9c04 100644
--- a/Lib/sqlite3/__init__.py
+++ b/Lib/sqlite3/__init__.py
@@ -55,17 +55,3 @@ The sqlite3 module is written by Gerhard Häring <gh@ghaering.de>.
"""
from sqlite3.dbapi2 import *
-
-
-# bpo-42264: OptimizedUnicode was deprecated in Python 3.10. It's scheduled
-# for removal in Python 3.12.
-def __getattr__(name):
- if name == "OptimizedUnicode":
- import warnings
- msg = ("""
- OptimizedUnicode is deprecated and will be removed in Python 3.12.
- Since Python 3.3 it has simply been an alias for 'str'.
- """)
- warnings.warn(msg, DeprecationWarning, stacklevel=2)
- return str
- raise AttributeError(f"module 'sqlite3' has no attribute '{name}'")
diff --git a/Lib/sqlite3/dbapi2.py b/Lib/sqlite3/dbapi2.py
index 7cf4dd3..36ce769 100644
--- a/Lib/sqlite3/dbapi2.py
+++ b/Lib/sqlite3/dbapi2.py
@@ -82,20 +82,6 @@ def register_adapters_and_converters():
register_adapters_and_converters()
-# bpo-24464: enable_shared_cache was deprecated in Python 3.10. It's
-# scheduled for removal in Python 3.12.
-def enable_shared_cache(enable):
- from _sqlite3 import enable_shared_cache as _old_enable_shared_cache
- import warnings
- msg = (
- "enable_shared_cache is deprecated and will be removed in Python 3.12. "
- "Shared cache is strongly discouraged by the SQLite 3 documentation. "
- "If shared cache must be used, open the database in URI mode using"
- "the cache=shared query parameter."
- )
- warnings.warn(msg, DeprecationWarning, stacklevel=2)
- return _old_enable_shared_cache(enable)
-
# Clean up namespace
del(register_adapters_and_converters)
diff --git a/Lib/test/test_sqlite3/test_dbapi.py b/Lib/test/test_sqlite3/test_dbapi.py
index e132fcd..8a21897 100644
--- a/Lib/test/test_sqlite3/test_dbapi.py
+++ b/Lib/test/test_sqlite3/test_dbapi.py
@@ -344,15 +344,6 @@ class ModuleTests(unittest.TestCase):
sqlite.SQLITE_CONSTRAINT_CHECK)
self.assertEqual(exc.sqlite_errorname, "SQLITE_CONSTRAINT_CHECK")
- # sqlite3_enable_shared_cache() is deprecated on macOS and calling it may raise
- # OperationalError on some buildbots.
- @unittest.skipIf(sys.platform == "darwin", "shared cache is deprecated on macOS")
- def test_shared_cache_deprecated(self):
- for enable in (True, False):
- with self.assertWarns(DeprecationWarning) as cm:
- 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")))
diff --git a/Lib/test/test_sqlite3/test_factory.py b/Lib/test/test_sqlite3/test_factory.py
index 420855b..71603fa 100644
--- a/Lib/test/test_sqlite3/test_factory.py
+++ b/Lib/test/test_sqlite3/test_factory.py
@@ -256,18 +256,6 @@ class TextFactoryTests(unittest.TestCase):
self.assertEqual(type(row[0]), str, "type of row[0] must be unicode")
self.assertTrue(row[0].endswith("reich"), "column must contain original data")
- def test_optimized_unicode(self):
- # OptimizedUnicode is deprecated as of Python 3.10
- with self.assertWarns(DeprecationWarning) as cm:
- self.con.text_factory = sqlite.OptimizedUnicode
- self.assertIn("factory.py", cm.filename)
- austria = "Österreich"
- germany = "Deutchland"
- a_row = self.con.execute("select ?", (austria,)).fetchone()
- d_row = self.con.execute("select ?", (germany,)).fetchone()
- self.assertEqual(type(a_row[0]), str, "type of non-ASCII row must be str")
- self.assertEqual(type(d_row[0]), str, "type of ASCII-only row must be str")
-
def tearDown(self):
self.con.close()