aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/sqlite3/dbapi2.py
diff options
context:
space:
mode:
authorErlend Egeberg Aasland <erlend.aasland@protonmail.com>2022-07-20 21:37:59 +0200
committerGitHub <noreply@github.com>2022-07-20 21:37:59 +0200
commit6dadf6ca019f2e19ca8f0344903be0c539263c30 (patch)
tree2d030286a92ceac2150a2d5ccbd5c77a3d1cbc6f /Lib/sqlite3/dbapi2.py
parent000a4eebe735b6aa527516cf70f5290c2b5163bf (diff)
downloadcpython-6dadf6ca019f2e19ca8f0344903be0c539263c30.tar.gz
cpython-6dadf6ca019f2e19ca8f0344903be0c539263c30.zip
gh-90016: Deprecate default sqlite3 adapters and converters (#94276)
Co-authored-by: CAM Gerlach <CAM.Gerlach@Gerlach.CAM>
Diffstat (limited to 'Lib/sqlite3/dbapi2.py')
-rw-r--r--Lib/sqlite3/dbapi2.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/sqlite3/dbapi2.py b/Lib/sqlite3/dbapi2.py
index 3b6d2f7ba2d..56fc0461e6c 100644
--- a/Lib/sqlite3/dbapi2.py
+++ b/Lib/sqlite3/dbapi2.py
@@ -55,16 +55,25 @@ Binary = memoryview
collections.abc.Sequence.register(Row)
def register_adapters_and_converters():
+ from warnings import warn
+
+ msg = ("The default {what} is deprecated as of Python 3.12; "
+ "see the sqlite3 documentation for suggested replacement recipes")
+
def adapt_date(val):
+ warn(msg.format(what="date adapter"), DeprecationWarning, stacklevel=2)
return val.isoformat()
def adapt_datetime(val):
+ warn(msg.format(what="datetime adapter"), DeprecationWarning, stacklevel=2)
return val.isoformat(" ")
def convert_date(val):
+ warn(msg.format(what="date converter"), DeprecationWarning, stacklevel=2)
return datetime.date(*map(int, val.split(b"-")))
def convert_timestamp(val):
+ warn(msg.format(what="timestamp converter"), DeprecationWarning, stacklevel=2)
datepart, timepart = val.split(b" ")
year, month, day = map(int, datepart.split(b"-"))
timepart_full = timepart.split(b".")