From e36f90db76251a20884093a39422b0a2aa8c5f4e Mon Sep 17 00:00:00 2001 From: d3fau1t Date: Wed, 3 May 2023 20:17:07 +0900 Subject: [PATCH 1/2] Fix xadd allow non negative maxlen --- redis/commands/core.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/redis/commands/core.py b/redis/commands/core.py index d67291b314..6d0d41ea32 100644 --- a/redis/commands/core.py +++ b/redis/commands/core.py @@ -3485,8 +3485,8 @@ def xadd( raise DataError("Only one of ```maxlen``` or ```minid``` may be specified") if maxlen is not None: - if not isinstance(maxlen, int) or maxlen < 1: - raise DataError("XADD maxlen must be a positive integer") + if not isinstance(maxlen, int) or maxlen < 0: + raise DataError("XADD maxlen must be non-negative integer") pieces.append(b"MAXLEN") if approximate: pieces.append(b"~") From 3e066629792bf768a925766690deb33a2fc8af27 Mon Sep 17 00:00:00 2001 From: d3fau1t Date: Wed, 3 May 2023 21:09:15 +0900 Subject: [PATCH 2/2] Update change log --- CHANGES | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES b/CHANGES index 3865ed1067..7d3e0787aa 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,4 @@ + * Fix `xadd` command to accept non-negative `maxlen` including 0 * Add `address_remap` parameter to `RedisCluster` * Fix incorrect usage of once flag in async Sentinel * asyncio: Fix memory leak caused by hiredis (#2693)