summaryrefslogtreecommitdiff
path: root/redis/client.py
diff options
context:
space:
mode:
authorAleksMat <matej.aleksandrov@sinergise.com>2020-05-09 20:37:24 +0200
committerAndy McCurdy <andy@andymccurdy.com>2020-05-09 13:58:28 -0700
commita7559fee257ad85aaaefad84d3566ef9bdda8a02 (patch)
tree78a71f6ee7215cc19056fd562d58c3e44d88c168 /redis/client.py
parent252c840ea2ade01637b4ed7c834dd83b130041b4 (diff)
downloadredis-py-a7559fee257ad85aaaefad84d3566ef9bdda8a02.tar.gz
Fix for HSET argument validation to allow any non-None key
Fixes #1337 Fixes #1341
Diffstat (limited to 'redis/client.py')
-rwxr-xr-xredis/client.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/redis/client.py b/redis/client.py
index cc77515..6777959 100755
--- a/redis/client.py
+++ b/redis/client.py
@@ -3034,14 +3034,14 @@ class Redis(object):
def hset(self, name, key=None, value=None, mapping=None):
"""
Set ``key`` to ``value`` within hash ``name``,
- Use ``mappings`` keyword args to set multiple key/value pairs
- for a hash ``name``.
+ ``mapping`` accepts a dict of key/value pairs that that will be
+ added to hash ``name``.
Returns the number of fields that were added.
"""
- if not key and not mapping:
+ if key is None and not mapping:
raise DataError("'hset' with no key value pairs")
items = []
- if key:
+ if key is not None:
items.extend((key, value))
if mapping:
for pair in mapping.items():