Is it just me, or..

Markus Stenberg Markus.Stenberg at p98.f112.n480.z2.fidonet.org
Sun Jul 4 20:19:28 EDT 1999


From: Markus Stenberg <mstenber at cc.Helsinki.FI>

Is there a bug in the handling of pipes with the Python? Esp. in
non-blocking way.

Example:
	(r,w)=os.pipe()
	r = os.fdopen(r, "r", 0)
	w = os.fdopen(w, "w", 16384)
	w.write('foobarbaz')
	select.select([r],[],[]) # returns r, as it should
	r.read(1) # returns 'f'
	select.select([r],[],[]) # blocks!

Now select _blocks_, despite there being obviously some data that at least
should not have been buffered elsewhere. Also, fdopened stuff's reading
features are bit annoying, as doing read(bigNumber) results in blocking
call, as opposed to recv(bigNumber)'s semantics. Thus instead of pipes
(=fast) I am using TCP/UNIX sockets (=slow) but they seem to work better
for what I need. Am I missing something really obvious?

This is on Linux, if it matters.

-Markus

-- 
	This message was written in, or processed by a Linux system. 
	Linux, as in Linus' *NIX, not Lignux, as in RHS' arrogance.




More information about the Python-list mailing list