Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6fd7120

Browse files
committed
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.
1 parent cfc21fc commit 6fd7120

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

Lib/asynchat.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ def writable (self):
165165
# return len(self.ac_out_buffer) or len(self.producer_fifo) or (not self.connected)
166166
# this is about twice as fast, though not as clear.
167167
return not (
168-
(self.ac_out_buffer is '') and
168+
(self.ac_out_buffer == '') and
169169
self.producer_fifo.is_empty() and
170170
self.connected
171171
)

0 commit comments

Comments
 (0)