)]}'
{"tests/functional/test_swiftclient.py":[{"author":{"_account_id":9576,"name":"Thai Tran","email":"tqtran@us.ibm.com","username":"tqtran"},"change_message_id":"4a1633d24ed056360aea956b244f8f17827b699e","unresolved":false,"context_lines":[{"line_number":327,"context_line":"        # verify that put using a generator yielding empty strings does not"},{"line_number":328,"context_line":"        # cause connection to be closed"},{"line_number":329,"context_line":"        def data():"},{"line_number":330,"context_line":"            yield b\"should\""},{"line_number":331,"context_line":"            yield b\"\""},{"line_number":332,"context_line":"            yield b\" tolerate\""},{"line_number":333,"context_line":"            yield b\"\""}],"source_content_type":"text/x-python","patch_set":1,"id":"1a6eadb0_f87d20b2","line":330,"updated":"2016-12-13 22:36:47.000000000","message":"What are the advantage of using byte literals instead of regular strings? performance or other reasons?","commit_id":"304da900daccce76d9f54ecd661211674daca591"},{"author":{"_account_id":15343,"name":"Tim Burke","email":"tburke@nvidia.com","username":"tburke"},"change_message_id":"01b6daed35d27ef0140aa69df62bd0ac8e2f3262","unresolved":false,"context_lines":[{"line_number":327,"context_line":"        # verify that put using a generator yielding empty strings does not"},{"line_number":328,"context_line":"        # cause connection to be closed"},{"line_number":329,"context_line":"        def data():"},{"line_number":330,"context_line":"            yield b\"should\""},{"line_number":331,"context_line":"            yield b\"\""},{"line_number":332,"context_line":"            yield b\" tolerate\""},{"line_number":333,"context_line":"            yield b\"\""}],"source_content_type":"text/x-python","patch_set":1,"id":"1a6eadb0_49de4840","line":330,"in_reply_to":"1a6eadb0_f87d20b2","updated":"2016-12-13 23:52:33.000000000","message":"The data gets plumbed straight through requests down to the socket. As a result, if you try yielding native strings under py3, you get something like\n\nTraceback (most recent call last):\n  File \".../python-swiftclient/tests/functional/test_swiftclient.py\", line 337, in test_put_object_using_generator\n    self.containername, self.objectname, data())\n  File \".../python-swiftclient/swiftclient/client.py\", line 1787, in put_object\n    response_dict\u003dresponse_dict)\n  File \".../python-swiftclient/swiftclient/client.py\", line 1638, in _retry\n    service_token\u003dself.service_token, **kwargs)\n  File \".../python-swiftclient/swiftclient/client.py\", line 1280, in put_object\n    conn.request(\u0027PUT\u0027, path, contents, headers)\n  File \".../python-swiftclient/swiftclient/client.py\", line 430, in request\n    files\u003dfiles, **self.requests_args)\n  File \".../python-swiftclient/swiftclient/client.py\", line 413, in _request\n    return self.request_session.request(*arg, **kwarg)\n  File \".../requests/sessions.py\", line 475, in request\n    resp \u003d self.send(prep, **send_kwargs)\n  File \".../requests/sessions.py\", line 596, in send\n    r \u003d adapter.send(request, **kwargs)\n  File \".../requests/adapters.py\", line 446, in send\n    low_conn.send(i)\n  File \".../http/client.py\", line 889, in send\n    self.sock.sendall(d)\nTypeError: a bytes-like object is required, not \u0027str\u0027\n\nI suppose we might be able to wrap whatever the developer provided and impose an encoding, but which? User\u0027s shell? The result of sys.getdefaultencoding()? UTF-8 everywhere, like on the server?\n\nWhere should we store the encoding we chose? A param on Content-Type seems a natural fit, but what if the user didn\u0027t specify a Content-Type? Do we now have to send one anyway? What if the user *did* specify a Content-Type, but it\u0027s something that\u0027s typically non-textual data?\n\nIt seemed simpler to accept the current limitations of the code and just always send bytes.","commit_id":"304da900daccce76d9f54ecd661211674daca591"}]}
