[IronPython] bytes and str in 2.7 io module

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

Jeff wrote:
> The one function that seems to cause problems (_RawIOBase.read()) already
> returns object. I think this only crops up when a subclass of io.RawIOBase
> overrides read() but returns a string - the io module will try to cast the result
> from object to Bytes, and fail with a TypeError.
> This is #29378 if anyone else is interested.

Ahh, yeah, we should probably have a helper method in here which will convert
the string back to bytes rather than all of these casts to Bytes.  It could also be
incompatible w/ CPython in that they *might* allow bytearray objects to be returned
too which these casts would also prevent.

More information about the Ironpython-users mailing list