Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return type differs between RESP2/3 for set operations, with hiredis #197

Open
aosh-ab7e opened this issue Aug 7, 2024 · 1 comment
Open

Comments

@aosh-ab7e
Copy link

aosh-ab7e commented Aug 7, 2024

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:

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'>
@aosh-ab7e
Copy link
Author

Is this relevant?
#189

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant