[Python-Dev] Stream codecs and _multibytecodec
Hye-Shik Chang
hyeshik at gmail.com
Fri Apr 21 03:29:00 CEST 2006
On 4/21/06, Thomas Wouters <thomas at python.org> wrote:
> While merging the trunk changes into the p3yk branch, I discovered what I
> think is a bug in the stream codecs. It's easily reproduced in the trunk: in
> Lib/codecs.py, make the 'Codec' class new-style. Then, suddenly, test_codecs
> will crash with an exception like this:
[snip]
> I'm not sure whether this attribute conflict is on purpose or not, but since
> it will break in the future, I suggest it gets fixed. It *looks* like
> renaming the _MultibyteStreamWriter attribute is the easiest solution, but I
> don't know which API has precedence.
The readonly attribute "stream" of _MultibyteStreamWriter is exactly
equivalent to codecs.StreamWriter's and it can't be removed to work correctly.
I intended to override all methods of StreamWriters. The only reason why it
inherits from codecs.StreamWriter is not to break isinstance(x, StreamWriter)
checks and nothing from StreamWriter is used at all.
I'll verify and fix it in p3yk branch soon. Thank you for the inspection!
Hye-Shik
More information about the Python-Dev
mailing list