diff options
author | Avital Fine <79420960+AvitalFineRedis@users.noreply.github.com> | 2021-10-21 16:23:33 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-21 17:23:33 +0300 |
commit | cf5c5865bb9947498f3810b028628f3d2ab14030 (patch) | |
tree | ec82815fd8ee5b5a6bdb774d23c53a0380865d6c /redis | |
parent | 638164b15840eddc0c58ae62d3e384b218d31c58 (diff) | |
download | redis-py-cf5c5865bb9947498f3810b028628f3d2ab14030.tar.gz |
Enable floating parameters in SET (ex and px) (#1635)
Diffstat (limited to 'redis')
-rw-r--r-- | redis/commands.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/redis/commands.py b/redis/commands.py index 44a7735..f2c1538 100644 --- a/redis/commands.py +++ b/redis/commands.py @@ -1174,12 +1174,18 @@ class Commands: pieces.append('EX') if isinstance(ex, datetime.timedelta): ex = int(ex.total_seconds()) - pieces.append(ex) + if isinstance(ex, int): + pieces.append(ex) + else: + raise DataError("ex must be datetime.timedelta or int") if px is not None: pieces.append('PX') if isinstance(px, datetime.timedelta): px = int(px.total_seconds() * 1000) - pieces.append(px) + if isinstance(px, int): + pieces.append(px) + else: + raise DataError("px must be datetime.timedelta or int") if exat is not None: pieces.append('EXAT') if isinstance(exat, datetime.datetime): |