diff --git a/redis/commands/core.py b/redis/commands/core.py index 45eddef65f..dfc2296797 100644 --- a/redis/commands/core.py +++ b/redis/commands/core.py @@ -5017,14 +5017,16 @@ def hset( """ if key is None and not mapping and not items: raise DataError("'hset' with no key value pairs") - items = items or [] + pieces = [] + if items: + pieces.extend(items) if key is not None: - items.extend((key, value)) + pieces.extend((key, value)) if mapping: for pair in mapping.items(): - items.extend(pair) + pieces.extend(pair) - return self.execute_command("HSET", name, *items) + return self.execute_command("HSET", name, *pieces) def hsetnx(self, name: str, key: str, value: str) -> Union[Awaitable[bool], bool]: """