diff --git a/CHANGES b/CHANGES index 8cfc47db18..ef983e4b51 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,4 @@ + * Fix async `read_response` to use `disable_decoding`. * Add 'aclose()' methods to async classes, deprecate async close(). * Fix #2831, add auto_close_connection_pool=True arg to asyncio.Redis.from_url() * Fix incorrect redis.asyncio.Cluster type hint for `retry_on_error` diff --git a/redis/_parsers/hiredis.py b/redis/_parsers/hiredis.py index b3247b71ec..1919d3658e 100644 --- a/redis/_parsers/hiredis.py +++ b/redis/_parsers/hiredis.py @@ -198,10 +198,16 @@ async def read_response( if not self._connected: raise ConnectionError(SERVER_CLOSED_CONNECTION_ERROR) from None - response = self._reader.gets() + if disable_decoding: + response = self._reader.gets(False) + else: + response = self._reader.gets() while response is False: await self.read_from_socket() - response = self._reader.gets() + if disable_decoding: + response = self._reader.gets(False) + else: + response = self._reader.gets() # if the response is a ConnectionError or the response is a list and # the first item is a ConnectionError, raise it as something bad