Skip to content

Commit

Permalink
added type checks for exat and pxat in set
Browse files Browse the repository at this point in the history
Signed-off-by: amirreza <[email protected]>
  • Loading branch information
amirreza8002 committed Dec 6, 2024
1 parent 9426f4a commit 0d21ea4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions valkey/commands/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -2313,11 +2313,15 @@ def set(
pieces.append("EXAT")
if isinstance(exat, datetime.datetime):
exat = int(exat.timestamp())
elif not isinstance(exat, int):
raise DataError("exat must be of type datetime.datetime or int")
pieces.append(exat)
if pxat is not None:
pieces.append("PXAT")
if isinstance(pxat, datetime.datetime):
pxat = int(pxat.timestamp() * 1000)
elif not isinstance(pxat, int):
raise DataError("pxat must be of type datetime.datetime or int")
pieces.append(pxat)
if keepttl:
pieces.append("KEEPTTL")
Expand Down

0 comments on commit 0d21ea4

Please sign in to comment.