From a1f401a58b213e400fbd8f0fa8dc5260a2389dab Mon Sep 17 00:00:00 2001 From: Erlend Egeberg Aasland Date: Tue, 17 Nov 2020 16:55:12 +0100 Subject: bpo-42264: Deprecate sqlite3.OptimizedUnicode (GH-23163) --- Lib/sqlite3/__init__.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'Lib/sqlite3/__init__.py') diff --git a/Lib/sqlite3/__init__.py b/Lib/sqlite3/__init__.py index 6c91df27cc..f001c0678e 100644 --- a/Lib/sqlite3/__init__.py +++ b/Lib/sqlite3/__init__.py @@ -21,3 +21,17 @@ # 3. This notice may not be removed or altered from any source distribution. 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}'") -- cgit v1.2.1