redis / redis-py

Redis Python client
MIT License
12.62k stars 2.52k forks source link

hgetall command broken in 5.1.0 #3401

Closed vharitonsky closed 3 weeks ago

vharitonsky commented 3 weeks ago

Version: 5.1.0 Platform: all

Description: HGETALL command with protocol 2 is broken due to recent cache functionality introduction:

    def hgetall(self, name: str) -> Union[Awaitable[dict], dict]:
        """
        Return a Python dict of the hash's name/value pairs

        For more information see https://redis.io/commands/hgetall
        """
        return self.execute_command("HGETALL", name, keys=[name])

at the same time there is a callback which does not accept keys parameter in parsers/helpers:

    "HGETALL": lambda r: r and pairs_to_dict(r) or {},

which results in

        self, connection: Connection, command_name: str, **options: t.Any
    ) -> t.Any:
        try:
            response = connection.read_response()
        except IOError:
            # socket was closed, but we are still using it
            raise ConnectionError
        if command_name in self.response_callbacks:
>           return self.response_callbacks[command_name](response, **options)
E           TypeError: <lambda>() got an unexpected keyword argument 'keys'
ericbuehl commented 3 weeks ago

I believe this issue is already reported here https://github.com/redis/redis-py/issues/3391

vladvildanov commented 3 weeks ago

Thanks for reaching out! It's related to the issue above, will be included into a hotfix

vharitonsky commented 3 weeks ago

Sorry, I searched by hgetall but could not find any issue, so I created this one, closing.