From 25db95d224d18fb7b7f53165aeaa87632b0230f2 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Fri, 12 May 2023 21:25:45 +0300 Subject: gh-103857: Update deprecation stacktrace to point to calling line (#104431) --- .../next/Library/2023-05-12-19-29-28.gh-issue-103857.0IzSxr.rst | 1 + Modules/_datetimemodule.c | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) create mode 100644 Misc/NEWS.d/next/Library/2023-05-12-19-29-28.gh-issue-103857.0IzSxr.rst 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 0000000..6e8162d --- /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 8f86fc9..8b417bd 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; } -- cgit v0.12