[issue5455] csv module no longer works as expected when file opened in binary mode

2009-04-05 Thread Georg Brandl
Georg Brandl added the comment: Setting #4847 as superseder. -- nosy: +georg.brandl resolution: -> duplicate status: open -> closed superseder: -> csv fails when file is opened in binary mode ___ Python tracker _

[issue5455] csv module no longer works as expected when file opened in binary mode

2009-03-09 Thread Skip Montanaro
Skip Montanaro added the comment: Jervis> So the returned lineobj is a bytes type and then the Jervis> PyUnicode_Check throws the error. Right, but given that fact how do you get a Unicode string out of the bytes without an encoding? You can't open a file in binary mode and give the encodi

[issue5455] csv module no longer works as expected when file opened in binary mode

2009-03-08 Thread John Machin
John Machin added the comment: This is in effect a duplicate of issue 4847. Summary: The docs are CORRECT. The 3.X implementation is WRONG. The 2.X implementation is CORRECT. See examples in my comment on issue 4847. -- message_count: 3.0 -> 4.0 nosy: +sjmachin nosy_count: 2.0 -> 3.0

[issue5455] csv module no longer works as expected when file opened in binary mode

2009-03-08 Thread Jervis Whitley
Jervis Whitley added the comment: Hi Skip, Currently, once we are sure the lineobj is a unicode obj we then get it's internal buffer using: line = PyUnicode_AsUnicode(lineobj); for the purpose of iterating through the line. is there an opportunity to use: line = PyBytes_AsString(lineobj);

[issue5455] csv module no longer works as expected when file opened in binary mode

2009-03-08 Thread Jervis Whitley
Jervis Whitley added the comment: in _csv.c, the check is done here: lineobj = PyIter_Next(self->input_iter); if (lineobj == NULL) { /* End of input OR exception */ if (!PyErr_Occurred() && self->field_len != 0) PyErr_Format(error_obj, "newline inside string"

[issue5455] csv module no longer works as expected when file opened in binary mode

2009-03-08 Thread Jervis Whitley
Changes by Jervis Whitley : -- nosy: +jdwhitley nosy_count: 1.0 -> 2.0 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubsc

[issue5455] csv module no longer works as expected when file opened in binary mode

2009-03-08 Thread Skip Montanaro
New submission from Skip Montanaro : I just discovered that the csv module's reader class in 3.x doesn't work as expected when used as documented. The requirement has always been that the CSV file is opened in binary mode so that embedded newlines in fields are screwed up. Alas, in 3.x files op