[pypy-commit] pypy default: Test and fix
arigo
noreply at buildbot.pypy.org
Mon Sep 24 18:10:35 CEST 2012
Author: Armin Rigo <arigo at tunes.org>
Branch:
Changeset: r57509:0db479b9983d
Date: 2012-09-24 18:06 +0200
http://bitbucket.org/pypy/pypy/changeset/0db479b9983d/
Log: Test and fix
diff --git a/pypy/module/_csv/interp_reader.py b/pypy/module/_csv/interp_reader.py
--- a/pypy/module/_csv/interp_reader.py
+++ b/pypy/module/_csv/interp_reader.py
@@ -182,9 +182,7 @@
"field - do you need to open the file "
"in universal-newline mode?")
- if (state == START_FIELD or
- state == IN_FIELD or
- state == QUOTE_IN_QUOTED_FIELD):
+ if state == IN_FIELD or state == QUOTE_IN_QUOTED_FIELD:
self.save_field(field_builder)
break
elif state == ESCAPED_CHAR:
@@ -195,6 +193,11 @@
elif state == ESCAPE_IN_QUOTED_FIELD:
self.add_char(field_builder, '\n')
state = IN_QUOTED_FIELD
+ elif state == START_FIELD:
+ # save empty field
+ field_builder = StringBuilder(1)
+ self.save_field(field_builder)
+ break
else:
break
#
diff --git a/pypy/module/_csv/test/test_reader.py b/pypy/module/_csv/test/test_reader.py
--- a/pypy/module/_csv/test/test_reader.py
+++ b/pypy/module/_csv/test/test_reader.py
@@ -96,3 +96,6 @@
assert r.line_num == 3
raises(StopIteration, r.next)
assert r.line_num == 3
+
+ def test_dubious_quote(self):
+ self._read_test(['12,12,1",'], [['12', '12', '1"', '']])
More information about the pypy-commit
mailing list