]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.12] gh-106392: Fix inconsistency in deprecation warnings in datetime module (GH...
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Wed, 31 Jan 2024 03:24:27 +0000 (04:24 +0100)
committerGitHub <noreply@github.com>
Wed, 31 Jan 2024 03:24:27 +0000 (19:24 -0800)
gh-106392: Fix inconsistency in deprecation warnings in datetime module (GH-114761)
(cherry picked from commit dc4cd2c9ba60e2ee7e534e2f6e93c4c135df23b9)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Lib/_pydatetime.py

index 0e34d8aacf531daaf79ebf598da914081f7f188e..cd0ea900bfb9b443919d253ec9940fb52d6b4779 100644 (file)
@@ -1805,7 +1805,7 @@ class datetime(date):
     def utcfromtimestamp(cls, t):
         """Construct a naive UTC datetime from a POSIX timestamp."""
         import warnings
-        warnings.warn("datetime.utcfromtimestamp() is deprecated and scheduled "
+        warnings.warn("datetime.datetime.utcfromtimestamp() is deprecated and scheduled "
                       "for removal in a future version. Use timezone-aware "
                       "objects to represent datetimes in UTC: "
                       "datetime.datetime.fromtimestamp(t, datetime.UTC).",
@@ -1823,8 +1823,8 @@ class datetime(date):
     def utcnow(cls):
         "Construct a UTC datetime from time.time()."
         import warnings
-        warnings.warn("datetime.utcnow() is deprecated and scheduled for "
-                      "removal in a future version. Instead, Use timezone-aware "
+        warnings.warn("datetime.datetime.utcnow() is deprecated and scheduled for "
+                      "removal in a future version. Use timezone-aware "
                       "objects to represent datetimes in UTC: "
                       "datetime.datetime.now(datetime.UTC).",
                       DeprecationWarning,