[Python-3000-checkins] r53932 - python/branches/p3yk/Python/bltinmodule.c

georg.brandl python-3000-checkins at python.org
Mon Feb 26 11:35:13 CET 2007


Author: georg.brandl
Date: Mon Feb 26 11:35:10 2007
New Revision: 53932

Modified:
   python/branches/p3yk/Python/bltinmodule.c
Log:
Fix leak in the print function.



Modified: python/branches/p3yk/Python/bltinmodule.c
==============================================================================
--- python/branches/p3yk/Python/bltinmodule.c	(original)
+++ python/branches/p3yk/Python/bltinmodule.c	Mon Feb 26 11:35:10 2007
@@ -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;


More information about the Python-3000-checkins mailing list