mirror of
https://github.com/python/cpython.git
synced 2025-09-27 02:39:58 +00:00
gh-106392: Fix inconsistency in deprecation warnings in datetime module (GH-114761)
This commit is contained in:
parent
348a72ce3f
commit
dc4cd2c9ba
1 changed files with 3 additions and 3 deletions
|
@ -1809,7 +1809,7 @@ class datetime(date):
|
||||||
def utcfromtimestamp(cls, t):
|
def utcfromtimestamp(cls, t):
|
||||||
"""Construct a naive UTC datetime from a POSIX timestamp."""
|
"""Construct a naive UTC datetime from a POSIX timestamp."""
|
||||||
import warnings
|
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 "
|
"for removal in a future version. Use timezone-aware "
|
||||||
"objects to represent datetimes in UTC: "
|
"objects to represent datetimes in UTC: "
|
||||||
"datetime.datetime.fromtimestamp(t, datetime.UTC).",
|
"datetime.datetime.fromtimestamp(t, datetime.UTC).",
|
||||||
|
@ -1827,8 +1827,8 @@ class datetime(date):
|
||||||
def utcnow(cls):
|
def utcnow(cls):
|
||||||
"Construct a UTC datetime from time.time()."
|
"Construct a UTC datetime from time.time()."
|
||||||
import warnings
|
import warnings
|
||||||
warnings.warn("datetime.utcnow() is deprecated and scheduled for "
|
warnings.warn("datetime.datetime.utcnow() is deprecated and scheduled for "
|
||||||
"removal in a future version. Instead, Use timezone-aware "
|
"removal in a future version. Use timezone-aware "
|
||||||
"objects to represent datetimes in UTC: "
|
"objects to represent datetimes in UTC: "
|
||||||
"datetime.datetime.now(datetime.UTC).",
|
"datetime.datetime.now(datetime.UTC).",
|
||||||
DeprecationWarning,
|
DeprecationWarning,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue