[Python-checkins] CVS: python/dist/src/Lib asynchat.py,1.14,1.15

Tim Peters tim_one@users.sourceforge.net
Sun, 08 Apr 2001 00:23:47 -0700


Update of /cvsroot/python/python/dist/src/Lib
In directory usw-pr-cvs1:/tmp/cvs-serv17801/python/dist/src/Lib

Modified Files:
	asynchat.py 
Log Message:
Fix from the Madusa mailing list:
    http://groups.yahoo.com/group/medusa/message/333

It's clear that Medusa should not be checking for an empty buffer
via "buf is ''".  The patch merely changes "is" to "==".  However,
there's a mystery here all the same:  Python attempts to store null
strings uniquely, so it's unclear why "buf is ''" ever returned
false when buf actually was empty.  *Some* string operations produce
non-unique null strings, e.g.

>>> "abc"*0 is "abc"*0
0
>>>

but they're rare, and I don't see any such operations in asynchat.


Index: asynchat.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/asynchat.py,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -r1.14 -r1.15
*** asynchat.py	2001/04/06 15:30:33	1.14
--- asynchat.py	2001/04/08 07:23:44	1.15
***************
*** 166,170 ****
          # this is about twice as fast, though not as clear.
          return not (
!                 (self.ac_out_buffer is '') and
                  self.producer_fifo.is_empty() and
                  self.connected
--- 166,170 ----
          # this is about twice as fast, though not as clear.
          return not (
!                 (self.ac_out_buffer == '') and
                  self.producer_fifo.is_empty() and
                  self.connected