[Python-checkins] gh-103857: Update deprecation stacktrace to point to calling line (#104431)
abalkin
webhook-mailer at python.org
Fri May 12 14:25:52 EDT 2023
https://github.com/python/cpython/commit/25db95d224d18fb7b7f53165aeaa87632b0230f2
commit: 25db95d224d18fb7b7f53165aeaa87632b0230f2
branch: main
author: Hugo van Kemenade <hugovk at users.noreply.github.com>
committer: abalkin <abalkin at users.noreply.github.com>
date: 2023-05-12T22:25:45+04:00
summary:
gh-103857: Update deprecation stacktrace to point to calling line (#104431)
files:
A Misc/NEWS.d/next/Library/2023-05-12-19-29-28.gh-issue-103857.0IzSxr.rst
M Modules/_datetimemodule.c
diff --git a/Misc/NEWS.d/next/Library/2023-05-12-19-29-28.gh-issue-103857.0IzSxr.rst b/Misc/NEWS.d/next/Library/2023-05-12-19-29-28.gh-issue-103857.0IzSxr.rst
new file mode 100644
index 000000000000..6e8162d9ecc2
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2023-05-12-19-29-28.gh-issue-103857.0IzSxr.rst
@@ -0,0 +1 @@
+Update datetime deprecations' stracktrace to point to the calling line
diff --git a/Modules/_datetimemodule.c b/Modules/_datetimemodule.c
index 8f86fc919662..8b417bdd0fb5 100644
--- a/Modules/_datetimemodule.c
+++ b/Modules/_datetimemodule.c
@@ -5147,7 +5147,7 @@ datetime_utcnow(PyObject *cls, PyObject *dummy)
if (PyErr_WarnEx(PyExc_DeprecationWarning,
"datetime.utcnow() is deprecated and scheduled for removal in a "
"future version. Use timezone-aware objects to represent datetimes "
- "in UTC: datetime.now(datetime.UTC).", 2))
+ "in UTC: datetime.now(datetime.UTC).", 1))
{
return NULL;
}
@@ -5190,7 +5190,7 @@ datetime_utcfromtimestamp(PyObject *cls, PyObject *args)
if (PyErr_WarnEx(PyExc_DeprecationWarning,
"datetime.utcfromtimestamp() is deprecated and scheduled for removal "
"in a future version. Use timezone-aware objects to represent "
- "datetimes in UTC: datetime.now(datetime.UTC).", 2))
+ "datetimes in UTC: datetime.now(datetime.UTC).", 1))
{
return NULL;
}
More information about the Python-checkins
mailing list