]> granicus.if.org Git - python/commitdiff
[3.6] Fix TypeError is asyncio/proactor_events (GH-993) (#2061)
authorYury Selivanov <yury@magic.io>
Sat, 10 Jun 2017 04:15:28 +0000 (00:15 -0400)
committerGitHub <noreply@github.com>
Sat, 10 Jun 2017 04:15:28 +0000 (00:15 -0400)
(cherry picked from commit 34792d25ab7329241ea24595286d65d54c266274)

Lib/asyncio/proactor_events.py

index ff12877fae2f23ac2dc8f8af20d566acbcd9f4de..a81645d9c5d859de2e2cda58484e36d0c4c2c926 100644 (file)
@@ -232,8 +232,9 @@ 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))
+            msg = ("data argument must be a bytes-like object, not '%s'" %
+                   type(data).__name__)
+            raise TypeError(msg)
         if self._eof_written:
             raise RuntimeError('write_eof() already called')