Simplify append_keyword_tzinfo() by using

PyUnicode_FromFormat().
This commit is contained in:
Walter Dörwald 2007-05-23 20:45:05 +00:00
parent 85d8e421a6
commit 517bcfeb6b
1 changed files with 2 additions and 10 deletions

View 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;
}