gh-106392: Fix inconsistency in deprecation warnings (#106436)

They used "datetime" to refer to both the object and the module.
This commit is contained in:
William Andrea 2023-09-01 18:31:21 -04:00 committed by GitHub
parent 3b73f9f00e
commit d5c5d4bfd3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1812,7 +1812,7 @@ class datetime(date):
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 @@ class datetime(date):
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()