-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Closed
Description
Version: Confirmed on redis-py 4.3.4, still in main. Redis 7.0.5
Platform: Python 3.10, Windows 10. Any OS and python version can reproduce.
Description:
The code for LMPOP gives the direction a default argument of None
which is not a valid argument for that function and would raise an error:
>>> redis.lmpop(1, "example")
Traceback (most recent call last):
...
File "site-packages\redis\commands\core.py", line 2551, in lmpop
return self.execute_command("LMPOP", *args)
File "site-packages\redis\client.py", line 1238, in execute_command
return conn.retry.call_with_retry(
...
File "site-packages\redis\connection.py", line 108, in encode
raise DataError(
redis.exceptions.DataError: Invalid input of type: 'NoneType'. Convert to a bytes, string, int or float first.
Running something like redis.lmpop(1, "example", direction="LEFT")
would not raise an error. The other functions around here do not have a default argument for direction.
Relevant code:
redis-py/redis/commands/core.py
Lines 2552 to 2569 in 936d49f
def lmpop( | |
self, | |
num_keys: int, | |
*args: List[str], | |
direction: str = None, | |
count: Optional[int] = 1, | |
) -> Union[Awaitable[list], list]: | |
""" | |
Pop ``count`` values (default 1) first non-empty list key from the list | |
of args provided key names. | |
For more information see https://redis.io/commands/lmpop | |
""" | |
args = [num_keys] + list(args) + [direction] | |
if count != 1: | |
args.extend(["COUNT", count]) | |
return self.execute_command("LMPOP", *args) |
Metadata
Metadata
Assignees
Labels
No labels