[Python-3000-checkins] r59181 - python/branches/py3k/Modules/_csv.c

georg.brandl python-3000-checkins at python.org
Sun Nov 25 01:52:22 CET 2007


Author: georg.brandl
Date: Sun Nov 25 01:52:21 2007
New Revision: 59181

Modified:
   python/branches/py3k/Modules/_csv.c
Log:
#1479: Fix refleak in csv module (from rev 59062).


Modified: python/branches/py3k/Modules/_csv.c
==============================================================================
--- python/branches/py3k/Modules/_csv.c	(original)
+++ python/branches/py3k/Modules/_csv.c	Sun Nov 25 01:52:21 2007
@@ -793,14 +793,13 @@
 					     "newline inside string");
                         return NULL;
                 }
-		if (!PyUnicode_Check(lineobj))
-		{
-			PyErr_Format(error_obj,
-				     "Iterator should return strings, "
-				     "not %.200s "
-				     "(did you open the file in text mode?)",
+		if (!PyUnicode_Check(lineobj)) {
+			PyErr_Format(error_obj, "iterator should return "
+				     "strings, not %.200s (did you open "
+				     "the file in text mode?)",
 				     lineobj->ob_type->tp_name
 				);
+			Py_DECREF(lineobj);
 			return NULL;
 		}
                 ++self->line_num;


More information about the Python-3000-checkins mailing list