[Twisted-Python] Could this be an error in pcp.py?

Gabriel Rossetti mailing_lists at evotex.ch
Wed Apr 23 09:31:08 EDT 2008


Hello,

I was looking at pcp.py and I noticed this :

    def resumeProducing(self):
        self.paused = False
        if self._buffer:
            data = ''.join(self._buffer)
            bytesSent = self._writeSomeData(data)
            if bytesSent < len(data):
                unsent = data[bytesSent:]
                assert not self.iAmStreaming, (
                    "Streaming producer did not write all its data.")
                self._buffer[:] = [unsent]
            else:
                self._buffer[:] = []
        else:
            bytesSent = 0
...


in the ProducerConsumerProxy class, self._writeSomeData(data) returns 
the length of what was written, but in the test right afterwards 
bytesSent is compared to len(data), but they both have the same value, 
shouldn't it be "if bytesSent < len(self._buffer):" instead?

Gabriel




More information about the Twisted-Python mailing list