Re: [IronPython] bytes and str in 2.7 io module

2010-11-09 Thread Dino Viehland
Michael wrote: > > Ha. :-) > > Does that mean you're no longer permitted to read the IronPython source > code. ;-) HA! That's actually a good point - but we got special permission to continue working on IronPython/IronRuby on our own time... It certainly covers writing new code, I'm assuming i

Re: [IronPython] bytes and str in 2.7 io module

2010-11-09 Thread Michael Foord
On 08/11/2010 19:44, Dino Viehland wrote: Jeff wrote: On Mon, Nov 8, 2010 at 10:55 AM, Dino Viehland wrote: 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

Re: [IronPython] bytes and str in 2.7 io module

2010-11-08 Thread Jeff Hardy
On Mon, Nov 8, 2010 at 10:55 AM, Dino Viehland wrote: > 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. Turns out there already was one: PythonIOModule.GetBytes(). I'll revert and make the changes to

Re: [IronPython] bytes and str in 2.7 io module

2010-11-08 Thread Jeff Hardy
On Mon, Nov 8, 2010 at 8:16 PM, Dino Viehland wrote: > Vernon wrote: > > Jeff: >   Make sure to check the Python 3 bindings as well. We don't want to loose > ground going in that direction, since IPy already has Python 3's best > feature -- all strings are Unicode. Maybe the equivalent of "if > sy

Re: [IronPython] bytes and str in 2.7 io module

2010-11-08 Thread Dino Viehland
Vernon wrote: Jeff: Make sure to check the Python 3 bindings as well. We don't want to loose ground going in that direction, since IPy already has Python 3's best feature -- all strings are Unicode. Maybe the equivalent of "if sys.version[0] >= '3':" should be buried in the helper so that that

Re: [IronPython] bytes and str in 2.7 io module

2010-11-08 Thread Vernon Cole
Jeff: Make sure to check the Python 3 bindings as well. We don't want to loose ground going in that direction, since IPy already has Python 3's best feature -- all strings are Unicode. Maybe the equivalent of "if sys.version[0] >= '3':" should be buried in the helper so that that wheel will not n

Re: [IronPython] bytes and str in 2.7 io module

2010-11-08 Thread Dino Viehland
Jeff wrote: > On Mon, Nov 8, 2010 at 10:55 AM, Dino Viehland > wrote: > > 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* > > all

Re: [IronPython] bytes and str in 2.7 io module

2010-11-08 Thread Jeff Hardy
On Mon, Nov 8, 2010 at 10:55 AM, Dino Viehland wrote: > 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 b

Re: [IronPython] bytes and str in 2.7 io module

2010-11-08 Thread Dino Viehland
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 TypeE

Re: [IronPython] bytes and str in 2.7 io module

2010-11-08 Thread Jeff Hardy
On Mon, Nov 8, 2010 at 10:18 AM, Dino Viehland wrote: > 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'

Re: [IronPython] bytes and str in 2.7 io module

2010-11-08 Thread Dino Viehland
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 byt