summaryrefslogtreecommitdiff
path: root/Doc/includes
diff options
context:
space:
mode:
authorAmaury Forgeot d'Arc <amauryfa@gmail.com>2011-11-06 15:10:48 +0100
committerAmaury Forgeot d'Arc <amauryfa@gmail.com>2011-11-06 15:10:48 +0100
commit864741b2c7aaabda736f917694a1d3b26700e8e3 (patch)
tree8a79396976bd3f512eec73f88abfb60ca787377e /Doc/includes
parent08ad2fbc7f7abb687327b22eb7f65ac388742ab9 (diff)
downloadcpython-git-864741b2c7aaabda736f917694a1d3b26700e8e3.tar.gz
Issue #13350: Replace most usages of PyUnicode_Format by PyUnicode_FromFormat.
Diffstat (limited to 'Doc/includes')
-rw-r--r--Doc/includes/noddy2.c18
-rw-r--r--Doc/includes/noddy3.c18
-rw-r--r--Doc/includes/noddy4.c18
3 files changed, 3 insertions, 51 deletions
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[] = {