From: Victor Stinner Date: Mon, 1 Feb 2016 11:46:38 +0000 (+0100) Subject: Fix error message in asyncio.selector_events. X-Git-Tag: v3.6.0a1~661^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3e7230904e475982d0aea2c0181ea9e04e0ac6b3;p=thirdparty%2FPython%2Fcpython.git Fix error message in asyncio.selector_events. Patch written by Carlo Beccarini . --- diff --git a/Lib/asyncio/selector_events.py b/Lib/asyncio/selector_events.py index 5b26631d80d3..812fac19f860 100644 --- a/Lib/asyncio/selector_events.py +++ b/Lib/asyncio/selector_events.py @@ -682,8 +682,8 @@ class _SelectorSocketTransport(_SelectorTransport): 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: raise RuntimeError('Cannot call write() after write_eof()') if not data: @@ -954,8 +954,8 @@ class _SelectorSslTransport(_SelectorTransport): 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 not data: return @@ -1010,8 +1010,8 @@ class _SelectorDatagramTransport(_SelectorTransport): def sendto(self, data, addr=None): 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 not data: return