Re: [Web-SIG] WSGI: allowing short reads

2014-09-27 Thread Antoine Pitrou
On Sun, 28 Sep 2014 10:43:33 +1300 Robert Collins wrote: > > > > It was in the context of improving streamed unpickling, which is > > a problem a bit similar - but less horrible - to JSON unserializing; > > since then, the problem was solved in a different way by adding a > > framing layer to pick

Re: [Web-SIG] WSGI: allowing short reads

2014-09-27 Thread Robert Collins
On 28 September 2014 00:00, Antoine Pitrou wrote: > > Hi, > > Robert Collins writes: >> >> https://github.com/python-web-sig/wsgi-ng/issues/5 >> >> tl;dr - we don't specify whether read(size) has to return size bytes >> or just not more than size, today. the IO library is clear that >> read(n) re

Re: [Web-SIG] WSGI: allowing short reads

2014-09-27 Thread Guido van Rossum
I am taking full responsibility for this inconsistency. The original read(n) used stdio's fread(), which reads exactly n bytes or until EOF, whichever comes first. The switch to 3.0 might have been a good time to fix this, but we didn't, and now it's too late. If I had to do it over again I would

Re: [Web-SIG] WSGI: allowing short reads

2014-09-27 Thread Antoine Pitrou
Hi, Robert Collins writes: > > https://github.com/python-web-sig/wsgi-ng/issues/5 > > tl;dr - we don't specify whether read(size) has to return size bytes > or just not more than size, today. the IO library is clear that > read(n) returns up to n, and also offers read1 that guarantees only > o

Re: [Web-SIG] WSGI: allowing short reads

2014-09-26 Thread Robert Collins
On 26 September 2014 18:16, Dirkjan Ochtman wrote: > On Fri, Sep 26, 2014 at 6:14 AM, Robert Collins > wrote: >> I don't think we need read1 (perhaps I'm wrong) but making read >> consistent with the io library would be good, I think - particularly >> for websockets. > > I would agree, but for we

Re: [Web-SIG] WSGI: allowing short reads

2014-09-25 Thread Dirkjan Ochtman
On Fri, Sep 26, 2014 at 6:14 AM, Robert Collins wrote: > I don't think we need read1 (perhaps I'm wrong) but making read > consistent with the io library would be good, I think - particularly > for websockets. I would agree, but for websockets, I'd really want a per-frame generator or something.

[Web-SIG] WSGI: allowing short reads

2014-09-25 Thread Robert Collins
https://github.com/python-web-sig/wsgi-ng/issues/5 tl;dr - we don't specify whether read(size) has to return size bytes or just not more than size, today. the IO library is clear that read(n) returns up to n, and also offers read1 that guarantees only one read call. I don't think we need read1 (p