From 517bcfeb6be448f47804900ac75c804d8f70a20e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Walter=20D=C3=B6rwald?= Date: Wed, 23 May 2007 20:45:05 +0000 Subject: Simplify append_keyword_tzinfo() by using PyUnicode_FromFormat(). --- Modules/datetimemodule.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/Modules/datetimemodule.c b/Modules/datetimemodule.c index d90a83c..f31b44c 100644 --- a/Modules/datetimemodule.c +++ b/Modules/datetimemodule.c @@ -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; } -- cgit v0.12