From 0d21ea4a12fa5ddd6edf63f57f3e738e759fffec Mon Sep 17 00:00:00 2001 From: amirreza Date: Fri, 6 Dec 2024 19:27:23 +0330 Subject: [PATCH] added type checks for exat and pxat in set Signed-off-by: amirreza --- valkey/commands/core.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/valkey/commands/core.py b/valkey/commands/core.py index 481ac6d2..5e915bfc 100644 --- a/valkey/commands/core.py +++ b/valkey/commands/core.py @@ -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")