diff options
author | Walter Dörwald <walter@livinglogic.de> | 2007-05-23 20:45:05 (GMT) |
---|---|---|
committer | Walter Dörwald <walter@livinglogic.de> | 2007-05-23 20:45:05 (GMT) |
commit | 517bcfeb6be448f47804900ac75c804d8f70a20e (patch) | |
tree | 44c3891a81e891e8de9fbc2ceef6f2f2a9759606 /Modules/datetimemodule.c | |
parent | 85d8e421a605c36893be46a7838adb1559d12ec1 (diff) | |
download | cpython-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.c | 12 |
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; } |