]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.14] gh-131825: Fix `sqlite3` timezone-naive adapter recipe (GH-136270) (GH-136467)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Wed, 9 Jul 2025 14:12:47 +0000 (16:12 +0200)
committerGitHub <noreply@github.com>
Wed, 9 Jul 2025 14:12:47 +0000 (14:12 +0000)
gh-131825: Fix `sqlite3` timezone-naive adapter recipe (GH-136270)
(cherry picked from commit 6a6cd3c07c0300c8799878a48d555470be2a52f7)

Co-authored-by: NekrodNIK <60639354+NekrodNIK@users.noreply.github.com>
Doc/library/sqlite3.rst

index e2726e53f09cd648ca12e5ae24c073a410c598bd..e939e61a9676ee0f0fa6dc45d92dc7ca6e64be00 100644 (file)
@@ -2289,7 +2289,7 @@ This section shows recipes for common adapters and converters.
 
    def adapt_datetime_iso(val):
        """Adapt datetime.datetime to timezone-naive ISO 8601 date."""
-       return val.isoformat()
+       return val.replace(tzinfo=None).isoformat()
 
    def adapt_datetime_epoch(val):
        """Adapt datetime.datetime to Unix timestamp."""