Open aosh-ab7e opened 1 month ago
With hiredis, set operations (such as SMEMBERS) returns different types between RESP2 and RESP3. I confirmed the difference was not observed without hiredis.
SMEMBERS
Redis(server): 7.4.0 Python: 3.12.4 redis(Python Library): 5.0.8 hiredis(Python Library): 3.0.0
Code:
from redis import Redis client = Redis(protocol=2) print("RESP2") print(type(client.smembers("test-set"))) print(type(client.sunion("test-set"))) print(type(client.sdiff("test-set"))) print(type(client.sinter("test-set"))) client = Redis(protocol=3) print("RESP3") print(type(client.smembers("test-set"))) print(type(client.sunion("test-set"))) print(type(client.sdiff("test-set"))) print(type(client.sinter("test-set")))
Output:
RESP2 <class 'set'> <class 'set'> <class 'set'> <class 'set'> RESP3 <class 'list'> <class 'list'> <class 'list'> <class 'list'>
Is this relevant?
Summary
With hiredis, set operations (such as
SMEMBERS
) returns different types between RESP2 and RESP3. I confirmed the difference was not observed without hiredis.Versions
Redis(server): 7.4.0 Python: 3.12.4 redis(Python Library): 5.0.8 hiredis(Python Library): 3.0.0
Example
Code:
Output: