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")