]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.12] gh-106392: Fix inconsistency in deprecation warnings (GH-106436) (#108792)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Sat, 2 Sep 2023 21:44:28 +0000 (14:44 -0700)
committerGitHub <noreply@github.com>
Sat, 2 Sep 2023 21:44:28 +0000 (23:44 +0200)
gh-106392: Fix inconsistency in deprecation warnings (GH-106436)

They used "datetime" to refer to both the object and the module.
(cherry picked from commit d5c5d4bfd3260219397326795d3b2ff62a9ab8cb)

Co-authored-by: William Andrea <william.j.andrea@gmail.com>
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()