From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Wed, 31 Jan 2024 03:24:27 +0000 (+0100) Subject: [3.12] gh-106392: Fix inconsistency in deprecation warnings in datetime module (GH... X-Git-Tag: v3.12.2~60 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2e8417eec4c33e7952808357ffc38357c71aa8fc;p=thirdparty%2FPython%2Fcpython.git [3.12] gh-106392: Fix inconsistency in deprecation warnings in datetime module (GH-114761) (#114767) gh-106392: Fix inconsistency in deprecation warnings in datetime module (GH-114761) (cherry picked from commit dc4cd2c9ba60e2ee7e534e2f6e93c4c135df23b9) Co-authored-by: Serhiy Storchaka --- diff --git a/Lib/_pydatetime.py b/Lib/_pydatetime.py index 0e34d8aacf53..cd0ea900bfb9 100644 --- a/Lib/_pydatetime.py +++ b/Lib/_pydatetime.py @@ -1805,7 +1805,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).", @@ -1823,8 +1823,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,