]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Fix from the Madusa mailing list:
authorTim Peters <tim.peters@gmail.com>
Sun, 8 Apr 2001 07:23:44 +0000 (07:23 +0000)
committerTim Peters <tim.peters@gmail.com>
Sun, 8 Apr 2001 07:23:44 +0000 (07:23 +0000)
    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.

Lib/asynchat.py

index 584aab9f3eb07f9813d47bbfc3fa85f87f5d7747..1f9fc6839be63c5f27b1b897e0014e1e41f831c8 100644 (file)
@@ -165,7 +165,7 @@ class async_chat (asyncore.dispatcher):
         # return len(self.ac_out_buffer) or len(self.producer_fifo) or (not self.connected)
         # this is about twice as fast, though not as clear.
         return not (
-                (self.ac_out_buffer is '') and
+                (self.ac_out_buffer == '') and
                 self.producer_fifo.is_empty() and
                 self.connected
                 )