[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 d5c5d4bfd3)

Co-authored-by: William Andrea <william.j.andrea@gmail.com>
This commit is contained in:
Miss Islington (bot) 2023-09-02 14:44:28 -07:00 committed by GitHub
parent 70a378c888
commit b862c25922
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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()