mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
Issue #13350: Replace most usages of PyUnicode_Format by PyUnicode_FromFormat.
This commit is contained in:
parent
08ad2fbc7f
commit
864741b2c7
7 changed files with 13 additions and 107 deletions
|
@ -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[] = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue