]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Simplify trivial calls of PyUnicode_FromFormat() (GH-111605)
authorSerhiy Storchaka <storchaka@gmail.com>
Wed, 1 Nov 2023 17:54:32 +0000 (19:54 +0200)
committerGitHub <noreply@github.com>
Wed, 1 Nov 2023 17:54:32 +0000 (19:54 +0200)
Modules/_xxsubinterpretersmodule.c
Modules/_zoneinfo.c

index 640fd69061d929d6cd803ec27964049053e6698b..ce0d511bc5aa2dc124c47946ac4b62b106a958a8 100644 (file)
@@ -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;
index 97e550197a2a8d46d941927562da8bd6299c91ab..77644c3155bc33eed71786d70e47c515724640b9 100644 (file)
@@ -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;
     }