[3.12] gh-106392: Fix inconsistency in deprecation warnings in datetime module (GH-114761) (#114767)
![](https://secure.gravatar.com/avatar/cc7737cd64a84f1b5c61a160798e97ee.jpg?s=120&d=mm&r=g)
https://github.com/python/cpython/commit/2e8417eec4c33e7952808357ffc38357c71... commit: 2e8417eec4c33e7952808357ffc38357c71aa8fc branch: 3.12 author: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> committer: hauntsaninja <12621235+hauntsaninja@users.noreply.github.com> date: 2024-01-30T19:24:27-08:00 summary: [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 <storchaka@gmail.com> files: M Lib/_pydatetime.py diff --git a/Lib/_pydatetime.py b/Lib/_pydatetime.py index 0e34d8aacf531d..cd0ea900bfb9b4 100644 --- a/Lib/_pydatetime.py +++ b/Lib/_pydatetime.py @@ -1805,7 +1805,7 @@ def fromtimestamp(cls, timestamp, tz=None): 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 @@ def now(cls, tz=None): 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,
participants (1)
-
hauntsaninja