From 7169e651831cc45de5f298aa5687c9bd7d60a019 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A7=8B=E8=91=89?= Date: Wed, 18 Sep 2019 00:33:34 +0800 Subject: [PATCH] [3.6] fix: correct exceptions string format (#4068) (cherry picked from commit 5d88cb0f) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: 秋葉 --- CHANGES/4068.bugfix | 1 + aiohttp/http_websocket.py | 9 ++++++--- aiohttp/payload.py | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) create mode 100644 CHANGES/4068.bugfix diff --git a/CHANGES/4068.bugfix b/CHANGES/4068.bugfix new file mode 100644 index 00000000000..54c82a16e7b --- /dev/null +++ b/CHANGES/4068.bugfix @@ -0,0 +1 @@ +correct some exception string format diff --git a/aiohttp/http_websocket.py b/aiohttp/http_websocket.py index 1684c6604dc..a75d3b1017f 100644 --- a/aiohttp/http_websocket.py +++ b/aiohttp/http_websocket.py @@ -365,9 +365,12 @@ def _feed_data(self, data: bytes) -> Tuple[bool, bytes]: left = len(self._decompressobj.unconsumed_tail) raise WebSocketError( WSCloseCode.MESSAGE_TOO_BIG, - "Decompressed message size exceeds limit {}". - format(self._max_msg_size + left, - self._max_msg_size)) + "Decompressed message size {} exceeds limit {}" + .format( + self._max_msg_size + left, + self._max_msg_size + ) + ) else: payload_merged = bytes(self._partial) diff --git a/aiohttp/payload.py b/aiohttp/payload.py index 5b110ba1dd1..7e633028d42 100644 --- a/aiohttp/payload.py +++ b/aiohttp/payload.py @@ -207,7 +207,7 @@ def __init__(self, *args: Any, **kwargs: Any) -> None: if not isinstance(value, (bytes, bytearray, memoryview)): - raise TypeError("value argument must be byte-ish, not (!r)" + raise TypeError("value argument must be byte-ish, not {!r}" .format(type(value))) if 'content_type' not in kwargs: