From 9ec91d2d44f8bb46c31ebb21849bd69a6a80d491 Mon Sep 17 00:00:00 2001 From: DimitrisJim Date: Sat, 25 Mar 2017 23:39:10 +0200 Subject: [PATCH 1/2] Fix TypeError messages in asynchat and proactor_events --- Lib/asyncio/proactor_events.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Lib/asyncio/proactor_events.py b/Lib/asyncio/proactor_events.py index ff12877fae2f23..72146b28ba6ad2 100644 --- a/Lib/asyncio/proactor_events.py +++ b/Lib/asyncio/proactor_events.py @@ -232,8 +232,8 @@ class _ProactorBaseWritePipeTransport(_ProactorBasePipeTransport, def write(self, data): if not isinstance(data, (bytes, bytearray, memoryview)): - raise TypeError('data argument must be byte-ish (%r)', - type(data)) + raise TypeError('data argument must be a bytes-like object, not %r' % + type(data).__name__) if self._eof_written: raise RuntimeError('write_eof() already called') From fc4c5640336010a864a9915f8e4f965adf0f5e75 Mon Sep 17 00:00:00 2001 From: DimitrisJim Date: Tue, 4 Apr 2017 22:22:21 +0300 Subject: [PATCH 2/2] Fix TypeError format in asyncio/proactor_events --- Lib/asynchat.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Lib/asynchat.py b/Lib/asynchat.py index fc1146adbb10dc..0e56a3da66b3e0 100644 --- a/Lib/asynchat.py +++ b/Lib/asynchat.py @@ -191,8 +191,8 @@ def handle_close(self): def push(self, data): if not isinstance(data, (bytes, bytearray, memoryview)): - raise TypeError('data argument must be byte-ish (%r)', - type(data)) + raise TypeError('data argument must be a bytes-like object, not %r' % + type(data).__name__) sabs = self.ac_out_buffer_size if len(data) > sabs: for i in range(0, len(data), sabs):