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

2009-04-05 Thread Georg Brandl
Georg Brandl ge...@python.org 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 rep...@bugs.python.org

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

2009-03-09 Thread Skip Montanaro
Skip Montanaro s...@pobox.com 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

[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 s...@pobox.com: 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,

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

2009-03-08 Thread Jervis Whitley
Changes by Jervis Whitley jervi...@gmail.com: -- nosy: +jdwhitley nosy_count: 1.0 - 2.0 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue5455 ___ ___

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

2009-03-08 Thread Jervis Whitley
Jervis Whitley jervi...@gmail.com 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

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

2009-03-08 Thread Jervis Whitley
Jervis Whitley jervi...@gmail.com 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 =

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

2009-03-08 Thread John Machin
John Machin sjmac...@users.sourceforge.net 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: