Simplify append_keyword_tzinfo() by using
PyUnicode_FromFormat().
This commit is contained in:
parent
85d8e421a6
commit
517bcfeb6b
|
@ -1055,16 +1055,8 @@ append_keyword_tzinfo(PyObject *repr, PyObject *tzinfo)
|
||||||
Py_DECREF(repr);
|
Py_DECREF(repr);
|
||||||
if (temp == NULL)
|
if (temp == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
repr = temp;
|
repr = PyUnicode_FromFormat("%U, tzinfo=%R)", temp, tzinfo);
|
||||||
|
Py_DECREF(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(")"));
|
|
||||||
return repr;
|
return repr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue