Python queue madness

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Thu Apr 3 00:39:27 EDT 2008


En Wed, 02 Apr 2008 10:52:08 -0300, nnp <version5 at gmail.com> escribió:

> Basically I have a system where component 1, 2 and 3 communicate with  
> each
> other using two Python Queues, we'll call them R and W. Here is what is
> happening
>
> 1 writes data to W and reads from R
> 2 reads data from W and writes data it receives from 3 to R (but not  
> data it
> receives from 1)
> 3 writes to W
>
> The problem is that data being written by 1 to W is appearing back on R.  
> I
> have verified that 1 never writes to R and that 2 never writes data it
> receives from 1 to R, by overwriting the put() and put_nowait() methods  
> of
> R.
>
> Is there any other way for data to get onto a queue or are there any  
> known
> bugs with Python's Queue module that could lead to this kind of  
> behaviour?

Yes, your own code :)
Perhaps you put mutable objects into the queue, like a list? and later  
modify the list in another place?

-- 
Gabriel Genellina




More information about the Python-list mailing list