classification
Title: Keepends param in codec readline(s)
Type: behavior Stage:
Components: Library (Lib) Versions: Python 3.2, Python 2.7
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: amccampos, benjamin.peterson, lemburg
Priority: normal Keywords:

Created on 2010-05-05 16:38 by amccampos, last changed 2010-05-08 18:36 by benjamin.peterson.

Files
File name Uploaded Description Edit
codecs.py amccampos, 2010-05-06 12:07 new codecs.py fixing the issue
Messages (6)
msg105056 - (view) Author: André M. C. Campos (amccampos) Date: 2010-05-05 16:38
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)
msg105128 - (view) Author: Marc-Andre Lemburg (lemburg) * (Python committer) Date: 2010-05-06 07:53
We can add those to 3.2. Not sure about 2.7 - it's already in feature freeze.
msg105132 - (view) Author: Marc-Andre Lemburg (lemburg) * (Python committer) Date: 2010-05-06 10:22
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.
msg105133 - (view) Author: Marc-Andre Lemburg (lemburg) * (Python committer) Date: 2010-05-06 10:23
André: Could you provide a patch ?

Thanks.
msg105140 - (view) Author: André M. C. Campos (amccampos) Date: 2010-05-06 12:06
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>
> _______________________________________
>
msg105324 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2010-05-08 18:36
I think this can qualify as a bug fix.
History
Date User Action Args
2010-05-08 18:36:49benjamin.petersonsetmessages: + msg105324
2010-05-06 12:07:58amccampossetfiles: + codecs.py
2010-05-06 12:06:34amccampossetmessages: + msg105140
2010-05-06 10:23:31lemburgsetassignee: benjamin.peterson ->
messages: + msg105133
2010-05-06 10:22:59lemburgsetassignee: benjamin.peterson

messages: + msg105132
nosy: + benjamin.peterson
2010-05-06 07:53:21lemburgsetmessages: + msg105128
versions: + Python 2.7, Python 3.2, - Python 2.6
2010-05-05 18:08:50r.david.murraysetnosy: + lemburg
2010-05-05 16:38:14amccamposcreate