Mercurial > cpython-lru_cache-weakref
diff Python/bltinmodule.c @ 40922:be41da66ce37
Fix leak in the print function.
| author | Georg Brandl <georg@python.org> |
|---|---|
| date | Mon, 26 Feb 2007 10:35:10 +0000 |
| parents | e9a6234b26af |
| children | a2629be1b1d0 |
line wrap: on
line diff
--- a/Python/bltinmodule.c Mon Feb 26 09:41:19 2007 +0000 +++ b/Python/bltinmodule.c Mon Feb 26 10:35:10 2007 +0000 @@ -1392,12 +1392,14 @@ 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;
