From 864741b2c7aaabda736f917694a1d3b26700e8e3 Mon Sep 17 00:00:00 2001 From: Amaury Forgeot d'Arc Date: Sun, 6 Nov 2011 15:10:48 +0100 Subject: Issue #13350: Replace most usages of PyUnicode_Format by PyUnicode_FromFormat. --- Doc/includes/noddy2.c | 18 +----------------- Doc/includes/noddy3.c | 18 +----------------- Doc/includes/noddy4.c | 18 +----------------- 3 files changed, 3 insertions(+), 51 deletions(-) (limited to 'Doc/includes') diff --git a/Doc/includes/noddy2.c b/Doc/includes/noddy2.c index c02d49b92e..964155845f 100644 --- a/Doc/includes/noddy2.c +++ b/Doc/includes/noddy2.c @@ -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[] = { diff --git a/Doc/includes/noddy3.c b/Doc/includes/noddy3.c index 002a0e10ad..8a5a753ca4 100644 --- a/Doc/includes/noddy3.c +++ b/Doc/includes/noddy3.c @@ -147,23 +147,7 @@ static PyGetSetDef Noddy_getseters[] = { 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; - } - - 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[] = { diff --git a/Doc/includes/noddy4.c b/Doc/includes/noddy4.c index c747682bb6..eb9622a87d 100644 --- a/Doc/includes/noddy4.c +++ b/Doc/includes/noddy4.c @@ -118,15 +118,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; @@ -137,14 +128,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[] = { -- cgit v1.2.1