From e24344d3295a30f32e0ba33602c968e5a447b238 Mon Sep 17 00:00:00 2001 From: Thomas W <69774548+yctomwang@users.noreply.github.com> Date: Tue, 4 Jul 2023 20:45:33 +1000 Subject: [PATCH] gh-106392: Fixed datetime UTC deprecation warnings use the name "datetime" inconsistently #106392 (#106392) Replace Modules/_datetimemodule.c's PyExc_DeprecationWarning with 'in UTC: datetime.now(timezone.utc)'. --- Modules/_datetimemodule.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/_datetimemodule.c b/Modules/_datetimemodule.c index db2d339fc36db4..d0889b99dfcd87 100644 --- a/Modules/_datetimemodule.c +++ b/Modules/_datetimemodule.c @@ -5138,7 +5138,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).", 1)) + "in UTC: datetime.now(timezone.utc).", 1)) { return NULL; }