Issue #13350: Replace most usages of PyUnicode_Format by PyUnicode_FromFormat.

This commit is contained in:
Amaury Forgeot d'Arc 2011-11-06 15:10:48 +01:00
parent 08ad2fbc7f
commit 864741b2c7
7 changed files with 13 additions and 107 deletions

View file

@ -84,15 +84,6 @@ static PyMemberDef Noddy_members[] = {
static PyObject *
Noddy_name(Noddy* self)
{
static PyObject *format = NULL;
PyObject *args, *result;
if (format == NULL) {
format = PyUnicode_FromString("%s %s");
if (format == NULL)
return NULL;
}
if (self->first == NULL) {
PyErr_SetString(PyExc_AttributeError, "first");
return NULL;
@ -103,14 +94,7 @@ Noddy_name(Noddy* self)
return NULL;
}
args = Py_BuildValue("OO", self->first, self->last);
if (args == NULL)
return NULL;
result = PyUnicode_Format(format, args);
Py_DECREF(args);
return result;
return PyUnicode_FromFormat("%S %S", self->first, self->last);
}
static PyMethodDef Noddy_methods[] = {