summaryrefslogtreecommitdiffstats
path: root/Lib/asynchat.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2014-07-07 22:26:36 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2014-07-07 22:26:36 (GMT)
commit630a4f63c539345a6432d6177931b5fcc2f18aa7 (patch)
treebed6342759b5925823a2ae7ece387925ad263ce2 /Lib/asynchat.py
parentfd5d1b51d64280d938b7cdc9d78c632b21b45dff (diff)
downloadcpython-630a4f63c539345a6432d6177931b5fcc2f18aa7.zip
cpython-630a4f63c539345a6432d6177931b5fcc2f18aa7.tar.gz
cpython-630a4f63c539345a6432d6177931b5fcc2f18aa7.tar.bz2
Issue #11259: asynchat.async_chat().set_terminator() now raises a ValueError if
the number of received bytes is negative.
Diffstat (limited to 'Lib/asynchat.py')
-rw-r--r--Lib/asynchat.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/Lib/asynchat.py b/Lib/asynchat.py
index 682dbd7..6e16891 100644
--- a/Lib/asynchat.py
+++ b/Lib/asynchat.py
@@ -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):