summaryrefslogtreecommitdiffstats
path: root/Modules/datetimemodule.c
diff options
context:
space:
mode:
authorWalter Dörwald <walter@livinglogic.de>2007-05-23 20:45:05 (GMT)
committerWalter Dörwald <walter@livinglogic.de>2007-05-23 20:45:05 (GMT)
commit517bcfeb6be448f47804900ac75c804d8f70a20e (patch)
tree44c3891a81e891e8de9fbc2ceef6f2f2a9759606 /Modules/datetimemodule.c
parent85d8e421a605c36893be46a7838adb1559d12ec1 (diff)
downloadcpython-517bcfeb6be448f47804900ac75c804d8f70a20e.zip
cpython-517bcfeb6be448f47804900ac75c804d8f70a20e.tar.gz
cpython-517bcfeb6be448f47804900ac75c804d8f70a20e.tar.bz2
Simplify append_keyword_tzinfo() by using
PyUnicode_FromFormat().
Diffstat (limited to 'Modules/datetimemodule.c')
-rw-r--r--Modules/datetimemodule.c12
1 files 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;
}