diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2014-07-07 22:00:30 (GMT) |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2014-07-07 22:00:30 (GMT) |
commit | d9e810a8701b92371232eece5896a799c33de505 (patch) | |
tree | 97e9d76d0babfc969275ebb4e9e9d60314957598 /Lib/asynchat.py | |
parent | ab826d11a310fd4d7c99f6cf449660b690846a3b (diff) | |
download | cpython-d9e810a8701b92371232eece5896a799c33de505.zip cpython-d9e810a8701b92371232eece5896a799c33de505.tar.gz cpython-d9e810a8701b92371232eece5896a799c33de505.tar.bz2 |
Issue #12523: asynchat.async_chat.push() now raises a TypeError if it doesn't
get a bytes string
Diffstat (limited to 'Lib/asynchat.py')
-rw-r--r-- | Lib/asynchat.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Lib/asynchat.py b/Lib/asynchat.py index f1a5731..0cc91a8 100644 --- a/Lib/asynchat.py +++ b/Lib/asynchat.py @@ -181,6 +181,9 @@ class async_chat (asyncore.dispatcher): self.close() def push (self, data): + if not isinstance(data, (bytes, bytearray, memoryview)): + raise TypeError('data argument must be byte-ish (%r)', + type(data)) sabs = self.ac_out_buffer_size if len(data) > sabs: for i in range(0, len(data), sabs): |