]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Simplify append_keyword_tzinfo() by using
authorWalter Dörwald <walter@livinglogic.de>
Wed, 23 May 2007 20:45:05 +0000 (20:45 +0000)
committerWalter Dörwald <walter@livinglogic.de>
Wed, 23 May 2007 20:45:05 +0000 (20:45 +0000)
PyUnicode_FromFormat().

Modules/datetimemodule.c

index d90a83cd7f541fefed4e20ae76d9d6311f62204a..f31b44c058d191459bb004b9a42f851cb442274e 100644 (file)
@@ -1055,16 +1055,8 @@ append_keyword_tzinfo(PyObject *repr, PyObject *tzinfo)
        Py_DECREF(repr);
        if (temp == NULL)
                return NULL;
-       repr = temp;
-
-       /* Append ", tzinfo=". */
-       PyUnicode_AppendAndDel(&repr, PyUnicode_FromString(", tzinfo="));
-
-       /* Append repr(tzinfo). */
-       PyUnicode_AppendAndDel(&repr, PyObject_Repr(tzinfo));
-
-       /* Add a closing paren. */
-       PyUnicode_AppendAndDel(&repr, PyUnicode_FromString(")"));
+       repr = PyUnicode_FromFormat("%U, tzinfo=%R)", temp, tzinfo);
+       Py_DECREF(temp);
        return repr;
 }