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

Created on 2010-05-05 16:38 by amccampos, last changed 2014-06-24 09:47 by serhiy.storchaka.

Files
File name Uploaded Description Edit
codecs.py amccampos, 2010-05-06 12:07 new codecs.py fixing the issue
Issue8630.patch BreamoreBoy, 2014-06-15 20:09 Patch to add missing keepends parameters review
45139b30afef.diff jeffrey.falgout, 2014-06-22 18:17 Adds missing parameters to readline and readlines. Adds tests to test_codecs.py review
Repositories containing patches
https://bitbucket.org/bloomberg/cpython#issue8630
Messages (8)
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.
msg220668 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2014-06-15 20:09
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.
msg221291 - (view) Author: Jeffrey Falgout (jeffrey.falgout) * Date: 2014-06-22 18:11
Wrote tests
History
Date User Action Args
2014-06-24 09:47:51serhiy.storchakasetversions: + Python 3.4, Python 3.5, - Python 3.2
2014-06-22 18:17:03jeffrey.falgoutsetfiles: + 45139b30afef.diff
2014-06-22 18:11:44jeffrey.falgoutsethgrepos: + hgrepo259

messages: + msg221291
nosy: + jeffrey.falgout
2014-06-15 20:09:10BreamoreBoysetfiles: + Issue8630.patch

nosy: + BreamoreBoy
messages: + msg220668

keywords: + patch
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