Skip to content

Pubsub messages and channel names are forced to be ASCII strings on Python 2 #146

@ludwigschwardt

Description

@ludwigschwardt

Pubsub message strings (and channel names) are explicitly encoded to the default encoding, which is a problem for the usual Python 2 strings.

Here is a simple example that breaks fakeredis but not redis-py on Python 2.7.13:

r = fakeredis.FakeStrictRedis()
p = r.pubsub()
p.subscribe('\xff')
# UnicodeDecodeError: 'ascii' codec can't decode byte 0xff in position 0: ordinal not in range(128)
p.subscribe('test')
r.publish('test', '\xff')
# UnicodeDecodeError: 'ascii' codec can't decode byte 0xff in position 0: ordinal not in range(128)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions