summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2014-07-08 00:01:28 +0200
committerVictor Stinner <victor.stinner@gmail.com>2014-07-08 00:01:28 +0200
commite8209dab6b28638bc5b7afd361f797ab302ac898 (patch)
treed0cf87542f639168643166aa8328756c7dbd2506 /Lib/asynchat.py
parent(Merge 3.4) Issue #21925: PyImport_Cleanup(): Remove unused parameter in (diff)
parentIssue #12523: asynchat.async_chat.push() now raises a TypeError if it doesn't (diff)
downloadcpython-e8209dab6b28638bc5b7afd361f797ab302ac898.tar.gz
cpython-e8209dab6b28638bc5b7afd361f797ab302ac898.tar.bz2
cpython-e8209dab6b28638bc5b7afd361f797ab302ac898.zip
(Merge 3.4) 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.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/Lib/asynchat.py b/Lib/asynchat.py
index ac83eeae72b..e5337f7e7c8 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):