mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
[3.12] Clarify distinction between datetime module and class in deprecation messages (GH-108073) (#108540)
Clarify distinction between datetime module and class in deprecation messages (GH-108073)
(cherry picked from commit 09343dba44
)
Co-authored-by: Clément Robert <cr52@protonmail.com>
This commit is contained in:
parent
0b0238d6a1
commit
07c0e24748
1 changed files with 4 additions and 4 deletions
|
@ -5145,9 +5145,9 @@ static PyObject *
|
||||||
datetime_utcnow(PyObject *cls, PyObject *dummy)
|
datetime_utcnow(PyObject *cls, PyObject *dummy)
|
||||||
{
|
{
|
||||||
if (PyErr_WarnEx(PyExc_DeprecationWarning,
|
if (PyErr_WarnEx(PyExc_DeprecationWarning,
|
||||||
"datetime.utcnow() is deprecated and scheduled for removal in a "
|
"datetime.datetime.utcnow() is deprecated and scheduled for removal in a "
|
||||||
"future version. Use timezone-aware objects to represent datetimes "
|
"future version. Use timezone-aware objects to represent datetimes "
|
||||||
"in UTC: datetime.now(datetime.UTC).", 1))
|
"in UTC: datetime.datetime.now(datetime.UTC).", 1))
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -5188,9 +5188,9 @@ static PyObject *
|
||||||
datetime_utcfromtimestamp(PyObject *cls, PyObject *args)
|
datetime_utcfromtimestamp(PyObject *cls, PyObject *args)
|
||||||
{
|
{
|
||||||
if (PyErr_WarnEx(PyExc_DeprecationWarning,
|
if (PyErr_WarnEx(PyExc_DeprecationWarning,
|
||||||
"datetime.utcfromtimestamp() is deprecated and scheduled for removal "
|
"datetime.datetime.utcfromtimestamp() is deprecated and scheduled for removal "
|
||||||
"in a future version. Use timezone-aware objects to represent "
|
"in a future version. Use timezone-aware objects to represent "
|
||||||
"datetimes in UTC: datetime.fromtimestamp(timestamp, datetime.UTC).", 1))
|
"datetimes in UTC: datetime.datetime.fromtimestamp(timestamp, datetime.UTC).", 1))
|
||||||
{
|
{
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue