[IronPython] bytes and str in 2.7 io module

Dino Viehland dinov at microsoft.com
Mon Nov 8 18:18:48 CET 2010

Jeff wrote:
> In IronPython 2.7, the io classes are pretty strict that subclasses must return
> bytes from read(). However, in CPython, bytes is an alias for str, and
> therefore returning a str is perfectly valid. In particular, the gzip module does
> this, and trying to fix it to handle bytes is a never-ending journey and could
> very well break other things. I think changing io to be less strict and accept
> strings as a result from read() is a better option.
> Is there anything that likely to be broken by doing so?

I think this will be fine.  It will be a binary breaking change (assuming we're talking
about just changing the return types on types in the io module to object) but we've 
always allowed those between major releases.  I doubt there's many (if any) callers to
these from C# anyway.

More information about the Ironpython-users mailing list