]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[Backport patch #649762] Fix for asynchat endless loop
authorAndrew M. Kuchling <amk@amk.ca>
Wed, 12 Mar 2003 14:11:00 +0000 (14:11 +0000)
committerAndrew M. Kuchling <amk@amk.ca>
Wed, 12 Mar 2003 14:11:00 +0000 (14:11 +0000)
When the null string is used as the terminator, it used to be the same
as None, meaning "collect all the data".  In the current code, however, it
falls into an endless loop; this change reverts to the old behavior.

Lib/asynchat.py

index 1f9fc6839be63c5f27b1b897e0014e1e41f831c8..72a212a86419d33ada6675255ee4bf39539db160 100644 (file)
@@ -94,7 +94,7 @@ class async_chat (asyncore.dispatcher):
         while self.ac_in_buffer:
             lb = len(self.ac_in_buffer)
             terminator = self.get_terminator()
-            if terminator is None:
+            if terminator is None or terminator == '':
                 # no terminator, collect it all
                 self.collect_incoming_data (self.ac_in_buffer)
                 self.ac_in_buffer = ''