Philip Jenvey avatar Philip Jenvey committed db79e2d

partly revert b59013f9587e, this part is needed for the recently fixed
http://bugs.python.org/issue16013

Comments (0)

Files changed (2)

pypy/module/_csv/interp_reader.py

 
     def save_field(self, field_builder):
         field = field_builder.build()
-        print "AFA SAVE FIELD", field
         if self.numeric_field:
             from pypy.objspace.std.strutil import ParseStringError
             from pypy.objspace.std.strutil import string_to_float
                             state != START_RECORD and state != EAT_CRNL and
                             (len(field_builder.build()) > 0 or
                              state == IN_QUOTED_FIELD)):
-                        raise self.error(u"newline inside string")
+                        if dialect.strict:
+                            raise self.error(u"newline inside string")
+                        else:
+                            self.save_field(field_builder)
+                            break
                 raise
             self.line_num += 1
             line = space.unicode_w(w_line)

pypy/module/_csv/test/test_reader.py

         self._read_test(['12,12,1",'], [['12', '12', '1"', '']])
 
     def test_read_eof(self):
-        self._read_test(['a,"'], [])
-        self._read_test(['"a'], 'Error')
-        self._read_test(['^'], 'Error', escapechar='^')
-        self._read_test(['a,"'], [], strict=True)
+        self._read_test(['a,"'], [['a', '']])
+        self._read_test(['"a'], [['a']])
+        self._read_test(['^'], [['\n']], escapechar='^')
+        self._read_test(['a,"'], 'Error', strict=True)
         self._read_test(['"a'], 'Error', strict=True)
         self._read_test(['^'], 'Error', escapechar='^', strict=True)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.