[ python-Bugs-1241507 ] StreamReader broken for byte string to byte string codecs

SourceForge.net noreply at sourceforge.net
Thu Jul 21 00:53:21 CEST 2005


Bugs item #1241507, was opened at 2005-07-20 13:47
Message generated for change (Comment added) made by doerwalter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1241507&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: Python 2.4
>Status: Closed
>Resolution: Fixed
Priority: 5
Submitted By: Graham Horler (grahamh)
Assigned to: Nobody/Anonymous (nobody)
Summary: StreamReader broken for byte string to byte string codecs

Initial Comment:
print sys.version
2.4.1 (#2, Jul 12 2005, 09:22:25)
[GCC 4.0.1 (Debian 4.0.1-1)]

Decoding to what (according to the documentation)
should be a byte string (using StreamReader) does one
of 2 incorrect things, depending on the default encoding:

1) If the byte string has values not in the current
default encoding then StreamReader.read() incorrectly
triggers an exception.

2) If the byte string can be accomodated by the current
default encoding then StreamReader.read() incorrectly
returns a unicode object.

The documentation says in lib/standard-encodings.html:
  "The result of the ``decoding'' direction is listed
as operand type in the table."
  "base64_codec ... byte string"

(This bug does not exist in python2.2 or 2.3)

The attached script demonstrates the 2 related bugs.

Many thanks,
Graham

----------------------------------------------------------------------

>Comment By: Walter Dörwald (doerwalter)
Date: 2005-07-21 00:53

Message:
Logged In: YES 
user_id=89016

Checked in a fix as:

Lib/codecs.py 1.46
Lib/test/test_codecs.py 1.24
Lib/codecs.py 1.35.2.8
Lib/test/test_codecs.py 1.15.2.6

Thanks for the report.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1241507&group_id=5470


More information about the Python-bugs-list mailing list