From: Serhiy Storchaka Date: Wed, 1 Nov 2023 17:54:32 +0000 (+0200) Subject: Simplify trivial calls of PyUnicode_FromFormat() (GH-111605) X-Git-Tag: v3.13.0a2~238 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=5d6db168b9cda58b4897763041a6109b93e421cb;p=thirdparty%2FPython%2Fcpython.git Simplify trivial calls of PyUnicode_FromFormat() (GH-111605) --- diff --git a/Modules/_xxsubinterpretersmodule.c b/Modules/_xxsubinterpretersmodule.c index 640fd69061d9..ce0d511bc5aa 100644 --- a/Modules/_xxsubinterpretersmodule.c +++ b/Modules/_xxsubinterpretersmodule.c @@ -307,7 +307,7 @@ _sharedexception_bind(PyObject *exc, int code, _sharedexception *sharedexc) } if (exc != NULL) { - PyObject *msgobj = PyUnicode_FromFormat("%S", exc); + PyObject *msgobj = PyObject_Str(exc); if (msgobj == NULL) { failure = "unable to format exception message"; code = ERR_NO_MEMORY; diff --git a/Modules/_zoneinfo.c b/Modules/_zoneinfo.c index 97e550197a2a..77644c3155bc 100644 --- a/Modules/_zoneinfo.c +++ b/Modules/_zoneinfo.c @@ -420,7 +420,7 @@ zoneinfo_ZoneInfo_from_file_impl(PyTypeObject *type, PyTypeObject *cls, return NULL; } - file_repr = PyUnicode_FromFormat("%R", file_obj); + file_repr = PyObject_Repr(file_obj); if (file_repr == NULL) { goto error; }