summaryrefslogtreecommitdiffstats
path: root/contrib/tools/python3/src/Lib/sqlite3
diff options
context:
space:
mode:
authorshadchin <[email protected]>2022-04-18 12:39:32 +0300
committershadchin <[email protected]>2022-04-18 12:39:32 +0300
commitd4be68e361f4258cf0848fc70018dfe37a2acc24 (patch)
tree153e294cd97ac8b5d7a989612704a0c1f58e8ad4 /contrib/tools/python3/src/Lib/sqlite3
parent260c02f5ccf242d9d9b8a873afaf6588c00237d6 (diff)
IGNIETFERRO-1816 Update Python 3 from 3.9.12 to 3.10.4
ref:9f96be6d02ee8044fdd6f124b799b270c20ce641
Diffstat (limited to 'contrib/tools/python3/src/Lib/sqlite3')
-rw-r--r--contrib/tools/python3/src/Lib/sqlite3/__init__.py14
-rw-r--r--contrib/tools/python3/src/Lib/sqlite3/dbapi2.py14
2 files changed, 28 insertions, 0 deletions
diff --git a/contrib/tools/python3/src/Lib/sqlite3/__init__.py b/contrib/tools/python3/src/Lib/sqlite3/__init__.py
index 1e717450c29..0dedf186b1a 100644
--- a/contrib/tools/python3/src/Lib/sqlite3/__init__.py
+++ b/contrib/tools/python3/src/Lib/sqlite3/__init__.py
@@ -55,3 +55,17 @@ The sqlite3 module is written by Gerhard Häring <[email protected]>.
"""
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/contrib/tools/python3/src/Lib/sqlite3/dbapi2.py b/contrib/tools/python3/src/Lib/sqlite3/dbapi2.py
index 991682ce9ef..cfe6225f46e 100644
--- a/contrib/tools/python3/src/Lib/sqlite3/dbapi2.py
+++ b/contrib/tools/python3/src/Lib/sqlite3/dbapi2.py
@@ -84,6 +84,20 @@ 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)