diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2014-07-07 22:34:48 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2014-07-07 22:34:48 (GMT) |
commit | db5f8fcde69d7f16261cfd763cd74a7e5e2d1383 (patch) | |
tree | 4b542ca21cee72240d4e68c23b10b7b97fb23e54 /Lib/asynchat.py | |
parent | 7b9328f51bee311ff943af660f3b5f1b35d4e196 (diff) | |
parent | 630a4f63c539345a6432d6177931b5fcc2f18aa7 (diff) | |
download | cpython-db5f8fcde69d7f16261cfd763cd74a7e5e2d1383.zip cpython-db5f8fcde69d7f16261cfd763cd74a7e5e2d1383.tar.gz cpython-db5f8fcde69d7f16261cfd763cd74a7e5e2d1383.tar.bz2 |
(Merge 3.4) 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.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Lib/asynchat.py b/Lib/asynchat.py index 91f0bb2..fc6cabe 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): |