Some methods in StreamReaderWriter class (codecs library) has different signatures from StreamReader methods. More precisely it's missing the keepends parameter in readline and readlines methods. So, we cannot code: fp = codecs.open(fileName, "r", "utf-8") lines = fp.readlines(keepends=False) or line = fp.readline(keepends=False)
Benjamin: Would the added parameter be a new feature or not ? It looks like an oversight when adding the parameter to the standard codec classes, so could be viewed as a bug.
The parameter would not be a new feature since the codecs docs states that: "The StreamReaderWriter allows wrapping streams which work in both read and write modes". The reader (StreamReader) accepts the parameter, so it's expected that StreamReaderWriter does the same. I'm not sure how to submit a patch. So, I'm submitting a new codecs.py file through the issue track interface (issue 8630). If it's not that in that way, could you please tell me the path? André. 2010/5/6 Marc-Andre Lemburg <report@bugs.python.org>: > > Marc-Andre Lemburg <mal@egenix.com> added the comment: > > André: Could you provide a patch ? > > Thanks. > > ---------- > assignee: benjamin.peterson -> > > _______________________________________ > Python tracker <report@bugs.python.org> > <http://bugs.python.org/issue8630> > _______________________________________ >
As codecs.py has changed I've generated a patch file which adds the missing parameters. I looked at test_codecs.py but could only find one reference to the StreamReaderWriter class in WithStmtTest. I'm sorry but I'll have to leave writing tests for StreamReaderWriter to somebody that's better qualified than myself.