mirror of
https://github.com/python/cpython.git
synced 2025-11-25 12:44:13 +00:00
Issue #11259: asynchat.async_chat().set_terminator() now raises a ValueError if
the number of received bytes is negative.
This commit is contained in:
parent
fd5d1b51d6
commit
630a4f63c5
3 changed files with 13 additions and 0 deletions
|
|
@ -99,6 +99,8 @@ class async_chat(asyncore.dispatcher):
|
|||
"""
|
||||
if isinstance(term, str) and self.use_encoding:
|
||||
term = bytes(term, self.encoding)
|
||||
elif isinstance(term, int) and term < 0:
|
||||
raise ValueError('the number of received bytes must be positive')
|
||||
self.terminator = term
|
||||
|
||||
def get_terminator(self):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue