summaryrefslogtreecommitdiffstats
path: root/Python/bltinmodule.c
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2007-02-26 10:35:10 (GMT)
committerGeorg Brandl <georg@python.org>2007-02-26 10:35:10 (GMT)
commit257d3d93caa1c5e8320ae1960e0d81e58a7b90c0 (patch)
treea404138f437428cbe8114f7cac9abf421a63bcbb /Python/bltinmodule.c
parentb79b78111ca651e5327e37f46f9a58c3a21196d7 (diff)
downloadcpython-257d3d93caa1c5e8320ae1960e0d81e58a7b90c0.zip
cpython-257d3d93caa1c5e8320ae1960e0d81e58a7b90c0.tar.gz
cpython-257d3d93caa1c5e8320ae1960e0d81e58a7b90c0.tar.bz2
Fix leak in the print function.
Diffstat (limited to 'Python/bltinmodule.c')
-rw-r--r--Python/bltinmodule.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c
index c71aed1..78aeeb7 100644
--- a/Python/bltinmodule.c
+++ b/Python/bltinmodule.c
@@ -1392,12 +1392,14 @@ static PyObject *
builtin_print(PyObject *self, PyObject *args, PyObject *kwds)
{
static char *kwlist[] = {"sep", "end", "file", 0};
- PyObject *dummy_args = PyTuple_New(0);
+ static PyObject *dummy_args;
PyObject *sep = NULL, *end = NULL, *file = NULL;
int i, err;
- if (dummy_args == NULL)
- return NULL;
+ if (dummy_args == NULL) {
+ if (!(dummy_args = PyTuple_New(0)))
+ return NULL;
+ }
if (!PyArg_ParseTupleAndKeywords(dummy_args, kwds, "|OOO:print",
kwlist, &sep, &end, &file))
return NULL;