mirror of
https://github.com/python/cpython.git
synced 2025-10-10 00:43:41 +00:00
[Patch #1002763] Allow long ints as terminator values; also, treat a terminator of 0 like the empty string or None
This commit is contained in:
parent
5ac2534bbc
commit
ca69f0248c
1 changed files with 2 additions and 2 deletions
|
@ -101,11 +101,11 @@ class async_chat (asyncore.dispatcher):
|
||||||
while self.ac_in_buffer:
|
while self.ac_in_buffer:
|
||||||
lb = len(self.ac_in_buffer)
|
lb = len(self.ac_in_buffer)
|
||||||
terminator = self.get_terminator()
|
terminator = self.get_terminator()
|
||||||
if terminator is None or terminator == '':
|
if not terminator:
|
||||||
# no terminator, collect it all
|
# no terminator, collect it all
|
||||||
self.collect_incoming_data (self.ac_in_buffer)
|
self.collect_incoming_data (self.ac_in_buffer)
|
||||||
self.ac_in_buffer = ''
|
self.ac_in_buffer = ''
|
||||||
elif isinstance(terminator, int):
|
elif isinstance(terminator, int) or isinstance(terminator, long):
|
||||||
# numeric terminator
|
# numeric terminator
|
||||||
n = terminator
|
n = terminator
|
||||||
if lb < n:
|
if lb < n:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue