]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[Patch #1002763] Allow long ints as terminator values; also, treat a terminator of...
authorAndrew M. Kuchling <amk@amk.ca>
Thu, 9 Jun 2005 14:59:45 +0000 (14:59 +0000)
committerAndrew M. Kuchling <amk@amk.ca>
Thu, 9 Jun 2005 14:59:45 +0000 (14:59 +0000)
Lib/asynchat.py

index 28b89a2bde4021ac00c52931387c10f2dd7bee32..6f99ba1063c85e48dae1c7f9a15965edcec4db61 100644 (file)
@@ -101,11 +101,11 @@ class async_chat (asyncore.dispatcher):
         while self.ac_in_buffer:
             lb = len(self.ac_in_buffer)
             terminator = self.get_terminator()
-            if terminator is None or terminator == '':
+            if not terminator:
                 # no terminator, collect it all
                 self.collect_incoming_data (self.ac_in_buffer)
                 self.ac_in_buffer = ''
-            elif isinstance(terminator, int):
+            elif isinstance(terminator, int) or isinstance(terminator, long):
                 # numeric terminator
                 n = terminator
                 if lb < n: