summaryrefslogtreecommitdiffstats
path: root/Lib/sqlite3/dbapi2.py
diff options
context:
space:
mode:
authorKalyan <kalyan.ben10@live.com>2022-06-07 23:34:50 (GMT)
committerGitHub <noreply@github.com>2022-06-07 23:34:50 (GMT)
commitffc58a9710172b2d716a810a9f303828f3ebf108 (patch)
tree09f09c68560fa331909287e6284738719bd95417 /Lib/sqlite3/dbapi2.py
parentf8eae6f5c35e9def07a732f6bc7744aae106f9b2 (diff)
downloadcpython-ffc58a9710172b2d716a810a9f303828f3ebf108.zip
cpython-ffc58a9710172b2d716a810a9f303828f3ebf108.tar.gz
cpython-ffc58a9710172b2d716a810a9f303828f3ebf108.tar.bz2
gh-93370: Deprecate sqlite3.version and sqlite3.version_info (#93482)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com> Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com> Co-authored-by: Erlend E. Aasland <erlend.aasland@protonmail.com>
Diffstat (limited to 'Lib/sqlite3/dbapi2.py')
-rw-r--r--Lib/sqlite3/dbapi2.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/Lib/sqlite3/dbapi2.py b/Lib/sqlite3/dbapi2.py
index 36ce769..3b6d2f7 100644
--- a/Lib/sqlite3/dbapi2.py
+++ b/Lib/sqlite3/dbapi2.py
@@ -25,6 +25,9 @@ import time
import collections.abc
from _sqlite3 import *
+from _sqlite3 import _deprecated_version
+
+_deprecated_names = frozenset({"version", "version_info"})
paramstyle = "qmark"
@@ -45,7 +48,7 @@ def TimeFromTicks(ticks):
def TimestampFromTicks(ticks):
return Timestamp(*time.localtime(ticks)[:6])
-version_info = tuple([int(x) for x in version.split(".")])
+_deprecated_version_info = tuple(map(int, _deprecated_version.split(".")))
sqlite_version_info = tuple([int(x) for x in sqlite_version.split(".")])
Binary = memoryview
@@ -85,3 +88,12 @@ register_adapters_and_converters()
# Clean up namespace
del(register_adapters_and_converters)
+
+def __getattr__(name):
+ if name in _deprecated_names:
+ from warnings import warn
+
+ warn(f"{name} is deprecated and will be removed in Python 3.14",
+ DeprecationWarning, stacklevel=2)
+ return globals()[f"_deprecated_{name}"]
+ raise AttributeError(f"module {__name__!r} has no attribute {name!r}")