Issue #13350: Replace most usages of PyUnicode_Format by PyUnicode_FromFormat.
diff --git a/Modules/_ctypes/_ctypes.c b/Modules/_ctypes/_ctypes.c
index e08dea1a..338c4f7 100644
--- a/Modules/_ctypes/_ctypes.c
+++ b/Modules/_ctypes/_ctypes.c
@@ -4599,38 +4599,20 @@
 static PyObject *
 Simple_repr(CDataObject *self)
 {
-    PyObject *val, *name, *args, *result;
-    static PyObject *format;
+    PyObject *val, *result;
 
     if (Py_TYPE(self)->tp_base != &Simple_Type) {
         return PyUnicode_FromFormat("<%s object at %p>",
                                    Py_TYPE(self)->tp_name, self);
     }
 
-    if (format == NULL) {
-        format = PyUnicode_InternFromString("%s(%r)");
-        if (format == NULL)
-            return NULL;
-    }
-
     val = Simple_get_value(self);
     if (val == NULL)
         return NULL;
 
-    name = PyUnicode_FromString(Py_TYPE(self)->tp_name);
-    if (name == NULL) {
-        Py_DECREF(val);
-        return NULL;
-    }
-
-    args = PyTuple_Pack(2, name, val);
-    Py_DECREF(name);
+    result = PyUnicode_FromFormat("%s(%R)",
+                                  Py_TYPE(self)->tp_name, val);
     Py_DECREF(val);
-    if (args == NULL)
-        return NULL;
-
-    result = PyUnicode_Format(format, args);
-    Py_DECREF(args);
     return result;
 }
 
diff --git a/Modules/_sqlite/cache.c b/Modules/_sqlite/cache.c
index 735a242..3693363 100644
--- a/Modules/_sqlite/cache.c
+++ b/Modules/_sqlite/cache.c
@@ -217,8 +217,6 @@
     pysqlite_Node* ptr;
     PyObject* prevkey;
     PyObject* nextkey;
-    PyObject* fmt_args;
-    PyObject* template;
     PyObject* display_str;
 
     ptr = self->first;
@@ -229,36 +227,21 @@
         } else {
             prevkey = Py_None;
         }
-        Py_INCREF(prevkey);
 
         if (ptr->next) {
             nextkey = ptr->next->key;
         } else {
             nextkey = Py_None;
         }
-        Py_INCREF(nextkey);
 
-        fmt_args = Py_BuildValue("OOO", prevkey, ptr->key, nextkey);
-        if (!fmt_args) {
-            return NULL;
-        }
-        template = PyUnicode_FromString("%s <- %s ->%s\n");
-        if (!template) {
-            Py_DECREF(fmt_args);
-            return NULL;
-        }
-        display_str = PyUnicode_Format(template, fmt_args);
-        Py_DECREF(template);
-        Py_DECREF(fmt_args);
+        display_str = PyUnicode_FromFormat("%S <- %S -> %S\n",
+                                           prevkey, ptr->key, nextkey);
         if (!display_str) {
             return NULL;
         }
         PyObject_Print(display_str, stdout, Py_PRINT_RAW);
         Py_DECREF(display_str);
 
-        Py_DECREF(prevkey);
-        Py_DECREF(nextkey);
-
         ptr = ptr->next;
     }