Commits

Armin Rigo committed 0db479b

Test and fix

Comments (0)

Files changed (2)

pypy/module/_csv/interp_reader.py

                                         "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:
             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
         #

pypy/module/_csv/test/test_reader.py

         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"', '']])