summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2007-11-25 00:52:21 (GMT)
committerGeorg Brandl <georg@python.org>2007-11-25 00:52:21 (GMT)
commitf519261563f8d9b06dfdc18937e7629666e5a54f (patch)
tree7e50751581d1e3d7e2702dec548ca1ec513b14a9 /Modules
parentceab6104694c56dc31926af149cbe133988f9574 (diff)
downloadcpython-f519261563f8d9b06dfdc18937e7629666e5a54f.zip
cpython-f519261563f8d9b06dfdc18937e7629666e5a54f.tar.gz
cpython-f519261563f8d9b06dfdc18937e7629666e5a54f.tar.bz2
#1479: Fix refleak in csv module (from rev 59062).
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_csv.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/Modules/_csv.c b/Modules/_csv.c
index 75cafb2..afa7810 100644
--- a/Modules/_csv.c
+++ b/Modules/_csv.c
@@ -793,14 +793,13 @@ Reader_iternext(ReaderObj *self)
"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;