You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
And two small unit tests, one with maps inside lists, which works, and one with maps inside sets, which gives segmentation fault.
def test_map_inside_list(reader):
reader.feed(b"*1\r\n%1\r\n+a\r\n:1\r\n")
assert [{b"a": 1}] == reader.gets()
def test_map_inside_set(reader):
reader.feed(b"~1\r\n%1\r\n+a\r\n:1\r\n")
assert reader.gets() is not None
In general I think it's not possible to store data like that into Redis, i.e. to have maps inside sets. It might well be that the COMMAND command is the only one returning such a structure in its response. Some code in redis-py relies on this however. I'm curious what are your thoughts on this. I don't see any elegant and easy solution.
The text was updated successfully, but these errors were encountered:
This surfaced from
redis-py
tests with RESP3. After debugging, it turns out that the response to theCOMMAND
command contains maps nested into sets.In Python it's not possible to store
dict
insideset
, because it is not hashable. The visible effect is that the call results in a segmentation fault.Here is a RESP3 fragment, that is part of the
XREAD
content in the response toCOMMAND
:A better visualization is this:
And two small unit tests, one with maps inside lists, which works, and one with maps inside sets, which gives segmentation fault.
In general I think it's not possible to store data like that into Redis, i.e. to have maps inside sets. It might well be that the
COMMAND
command is the only one returning such a structure in its response. Some code inredis-py
relies on this however. I'm curious what are your thoughts on this. I don't see any elegant and easy solution.The text was updated successfully, but these errors were encountered: