Skip to content

Commit 935eb4e

Browse files
Jochen Sprickerhofbmerry
authored andcommitted
SINTER[STORE] requires keys to be sets
Starting with Redis 6.0.15 this behaviour changed. The definition of SINTER[STORE] states: "Keys that do not exist are considered to be empty sets." At the same time SINTER only accepts set: "intersection of all the given sets" Both quotes from: https://redis.io/commands/sinter. The behaviour of Redis 6.0.14 was that it ignored the type of later keys if it found an empty set and returned that. Radis 6.0.15 changed this behaviour to return a WRONGTYPE if it finds a non set key in the arguments. Example to reproduce: 127.0.0.1:6379> FLUSHALL OK 127.0.0.1:6379> SINTER a b (empty array) 127.0.0.1:6379> SET b something OK 127.0.0.1:6379> SINTER a b (error) WRONGTYPE Operation against a key holding the wrong kind of value Cf. redis/redis#9273.
1 parent 5df7d58 commit 935eb4e

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

fakeredis/_server.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1902,13 +1902,11 @@ def sdiff(self, *keys):
19021902
def sdiffstore(self, dst, *keys):
19031903
return self._setop(lambda a, b: a - b, False, dst, *keys)
19041904

1905-
# The following keys can't be marked as sets because of the
1906-
# stop_if_empty early-out.
1907-
@command((Key(set),), (Key(),))
1905+
@command((Key(set),), (Key(set),))
19081906
def sinter(self, *keys):
19091907
return self._setop(lambda a, b: a & b, True, None, *keys)
19101908

1911-
@command((Key(), Key(set)), (Key(),))
1909+
@command((Key(), Key(set)), (Key(set),))
19121910
def sinterstore(self, dst, *keys):
19131911
return self._setop(lambda a, b: a & b, True, dst, *keys)
19141912

0 commit comments

Comments
 (0)