]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-106392: Fix inconsistency in deprecation warnings in datetime module (GH-114761)
authorSerhiy Storchaka <storchaka@gmail.com>
Tue, 30 Jan 2024 22:15:33 +0000 (00:15 +0200)
committerGitHub <noreply@github.com>
Tue, 30 Jan 2024 22:15:33 +0000 (22:15 +0000)
Lib/_pydatetime.py

index 355145387e355bbb749dd052e3d8f092ebfdc400..54c12d3b2f3f16a2e337d17d4563b6e8246b087c 100644 (file)
@@ -1809,7 +1809,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).",
@@ -1827,8 +1827,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,