]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Inspired by Tim Peters' 1.14->1.15 checkin to asynchat
authorMoshe Zadka <moshez@math.huji.ac.il>
Wed, 11 Apr 2001 08:06:02 +0000 (08:06 +0000)
committerMoshe Zadka <moshez@math.huji.ac.il>
Wed, 11 Apr 2001 08:06:02 +0000 (08:06 +0000)
Quoting orignal 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.
'''

Lib/asynchat.py

index 095cb70e96281c8049e18e756e26d91f3db0f15e..9a26ab56b9e9d8df9618ed12fa9d85be001f2f07 100644 (file)
@@ -166,7 +166,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
                        )