From: Serhiy Storchaka Date: Tue, 30 Jan 2024 22:15:33 +0000 (+0200) Subject: gh-106392: Fix inconsistency in deprecation warnings in datetime module (GH-114761) X-Git-Tag: v3.13.0a4~247 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=dc4cd2c9ba60e2ee7e534e2f6e93c4c135df23b9;p=thirdparty%2FPython%2Fcpython.git gh-106392: Fix inconsistency in deprecation warnings in datetime module (GH-114761) --- diff --git a/Lib/_pydatetime.py b/Lib/_pydatetime.py index 355145387e35..54c12d3b2f3f 100644 --- a/Lib/_pydatetime.py +++ b/Lib/_pydatetime.py @@ -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,