{"action":"created","issue":{"url":"https://api.github.com/repos/Grokzen/redis-py-cluster/issues/170","repository_url":"https://api.github.com/repos/Grokzen/redis-py-cluster","labels_url":"https://api.github.com/repos/Grokzen/redis-py-cluster/issues/170/labels{/name}","comments_url":"https://api.github.com/repos/Grokzen/redis-py-cluster/issues/170/comments","events_url":"https://api.github.com/repos/Grokzen/redis-py-cluster/issues/170/events","html_url":"https://github.com/Grokzen/redis-py-cluster/pull/170","id":194550842,"number":170,"title":"Add support for bytes keys that are not utf-8 compatible","user":{"login":"0xabe-io","id":5858593,"avatar_url":"https://avatars.githubusercontent.com/u/5858593?v=3","gravatar_id":"","url":"https://api.github.com/users/0xabe-io","html_url":"https://github.com/0xabe-io","followers_url":"https://api.github.com/users/0xabe-io/followers","following_url":"https://api.github.com/users/0xabe-io/following{/other_user}","gists_url":"https://api.github.com/users/0xabe-io/gists{/gist_id}","starred_url":"https://api.github.com/users/0xabe-io/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/0xabe-io/subscriptions","organizations_url":"https://api.github.com/users/0xabe-io/orgs","repos_url":"https://api.github.com/users/0xabe-io/repos","events_url":"https://api.github.com/users/0xabe-io/events{/privacy}","received_events_url":"https://api.github.com/users/0xabe-io/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-12-09T09:35:28Z","updated_at":"2016-12-09T09:45:59Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/Grokzen/redis-py-cluster/pulls/170","html_url":"https://github.com/Grokzen/redis-py-cluster/pull/170","diff_url":"https://github.com/Grokzen/redis-py-cluster/pull/170.diff","patch_url":"https://github.com/Grokzen/redis-py-cluster/pull/170.patch"},"body":"The change enables the support of all possible bytes object as the redis-py library does. As of now if bytes that are not available in utf-8 are used in keys, the client crashes:\r\n```\r\n>>> con = rediscluster.StrictRedisCluster(startup_nodes=NODES)\r\n[{'port': '6379', 'host': '213.244.194.42'}, {'port': '6379', 'host': '213.244.194.43'}, {'port': '6379', 'host': '213.244.194.44'}, {'port': '6379', 'host': '213.244.194.70'}, {'port': '6379', 'host': '213.244.194.78'}, {'port': '6379', 'host': '213.244.194.81'}]\r\n>>> con.set(b'\\x01', 0x01)\r\nTrue\r\n>>> con.set(b'\\xa1', 0xa1)\r\nTraceback (most recent call last):\r\n  File \"<stdin>\", line 1, in <module>\r\n  File \"/usr/lib/python3.5/site-packages/redis/client.py\", line 1072, in set\r\n    return self.execute_command('SET', *pieces)\r\n  File \"/home/abe/research/libcmonger/rediscluster/utils.py\", line 101, in inner\r\n    return func(*args, **kwargs)\r\n  File \"/home/abe/research/libcmonger/rediscluster/client.py\", line 308, in execute_command\r\n    slot = self._determine_slot(*args)\r\n  File \"/home/abe/research/libcmonger/rediscluster/client.py\", line 254, in _determine_slot\r\n    return self.connection_pool.nodes.keyslot(key)\r\n  File \"/home/abe/research/libcmonger/rediscluster/nodemanager.py\", line 70, in keyslot_py_3\r\n    k = str(key, encoding='utf-8')\r\nUnicodeDecodeError: 'utf-8' codec can't decode byte 0xa1 in position 0: invalid start byte\r\n```\r\n\r\nInstead of converting a bytes back to str, just use bytes for all keys as redis-py does:\r\n```\r\n>>> con.set(b'\\xa1', 0xa1)\r\nTrue\r\n>>> hex(int(con.get(b'\\xa1')))\r\n'0xa1'\r\n```"},"comment":{"url":"https://api.github.com/repos/Grokzen/redis-py-cluster/issues/comments/265973837","html_url":"https://github.com/Grokzen/redis-py-cluster/pull/170#issuecomment-265973837","issue_url":"https://api.github.com/repos/Grokzen/redis-py-cluster/issues/170","id":265973837,"user":{"login":"coveralls","id":2354108,"avatar_url":"https://avatars.githubusercontent.com/u/2354108?v=3","gravatar_id":"","url":"https://api.github.com/users/coveralls","html_url":"https://github.com/coveralls","followers_url":"https://api.github.com/users/coveralls/followers","following_url":"https://api.github.com/users/coveralls/following{/other_user}","gists_url":"https://api.github.com/users/coveralls/gists{/gist_id}","starred_url":"https://api.github.com/users/coveralls/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coveralls/subscriptions","organizations_url":"https://api.github.com/users/coveralls/orgs","repos_url":"https://api.github.com/users/coveralls/repos","events_url":"https://api.github.com/users/coveralls/events{/privacy}","received_events_url":"https://api.github.com/users/coveralls/received_events","type":"User","site_admin":false},"created_at":"2016-12-09T09:45:59Z","updated_at":"2016-12-09T09:45:59Z","body":"\n[![Coverage Status](https://coveralls.io/builds/9203520/badge)](https://coveralls.io/builds/9203520)\n\nCoverage decreased (-0.06%) to 87.366% when pulling **cd7b01f0b7d2da7933852d947f4ed25fbe256b71 on 0xabe-io:unstable** into **4fb6b474a90516ba68d6dd64a2b8a2f2fed36a0c on Grokzen:unstable**.\n"}}
{"actor":{"display_login":"coveralls"}}