]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-106392: Fix inconsistency in deprecation warnings (#106436)
authorWilliam Andrea <william.j.andrea@gmail.com>
Fri, 1 Sep 2023 22:31:21 +0000 (18:31 -0400)
committerGitHub <noreply@github.com>
Fri, 1 Sep 2023 22:31:21 +0000 (22:31 +0000)
They used "datetime" to refer to both the object and the module.

Lib/_pydatetime.py

index f4fc2c58e5e2937ee5cbcf0d12569a65d8d9629b..549fcda19dccf249ea7443ef937fa26ae3374d7f 100644 (file)
@@ -1812,7 +1812,7 @@ class datetime(date):
         warnings.warn("datetime.utcfromtimestamp() is deprecated and scheduled "
                       "for removal in a future version. Use timezone-aware "
                       "objects to represent datetimes in UTC: "
-                      "datetime.fromtimestamp(t, datetime.UTC).",
+                      "datetime.datetime.fromtimestamp(t, datetime.UTC).",
                       DeprecationWarning,
                       stacklevel=2)
         return cls._fromtimestamp(t, True, None)
@@ -1830,7 +1830,7 @@ class datetime(date):
         warnings.warn("datetime.utcnow() is deprecated and scheduled for "
                       "removal in a future version. Instead, Use timezone-aware "
                       "objects to represent datetimes in UTC: "
-                      "datetime.now(datetime.UTC).",
+                      "datetime.datetime.now(datetime.UTC).",
                       DeprecationWarning,
                       stacklevel=2)
         t = _time.time()