[Python-ideas] BufferedIO and detach

Antoine Pitrou solipsis at pitrou.net
Tue Mar 5 08:31:22 CET 2013


On Tue, 5 Mar 2013 10:50:01 +1300
Robert Collins
<robertc at robertcollins.net> wrote:
> On 5 March 2013 10:32, Antoine Pitrou <solipsis at pitrou.net> wrote:
> > On Tue, 5 Mar 2013 10:29:35 +1300
> > Robert Collins
> > <robertc at robertcollins.net> wrote:
> >> >
> >> > How about the fileno() method?
> >>
> >> What about it? Do you mean 'non-blocking mode is entirely defined by
> >> the OS level read() behaviour and there is no tracking of that state
> >> higher up' ? If so cool (and we should document that somewhere).
> >
> > Yes, I mean that :-) You're right, it should be documented.
> >
> >> I'll
> >> need to go lookup the windows equivalent to FCNTL, and I still think
> >> the current hidden buffer status is problematic.
> >
> > Windows has no notion of non-blocking streams, except for sockets.
> 
> Hmm, I know the libc emulation layer doesn't - but
> http://msdn.microsoft.com/en-us/library/ms684961%28VS.85%29.aspx does
> non-blocking IO (for stdin specifically) - we should be able to hook
> that in, in principle...

I didn't know about that. I wonder, what happens if the standard input
is redirected?
Also, is it able to read actual raw bytes? INPUT_RECORD looks rather
specialized:
http://msdn.microsoft.com/en-us/library/ms683499%28v=vs.85%29.aspx

>  and disk files can do nonblocking with
> overlapped IO (though that is a wholly different beast and clearly
> offtopic :)).

It's not non-blocking then, it's asynchronous (it's blocking but in
another thread ;-)).

Regards

Antoine.





More information about the Python-ideas mailing list