From b862c25922764eb7bb3cd93dc91fd15c8e92d4f2 Mon Sep 17 00:00:00 2001 From: "Miss Islington (bot)" <31488909+miss-islington@users.noreply.github.com> Date: Sat, 2 Sep 2023 14:44:28 -0700 Subject: [PATCH] [3.12] gh-106392: Fix inconsistency in deprecation warnings (GH-106436) (#108792) 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 --- Lib/_pydatetime.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Lib/_pydatetime.py b/Lib/_pydatetime.py index f4fc2c58e5e293..549fcda19dccf2 100644 --- a/Lib/_pydatetime.py +++ b/Lib/_pydatetime.py @@ -1812,7 +1812,7 @@ def utcfromtimestamp(cls, t): 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 @@ def utcnow(cls): 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()