)]}'
{"neutron/agent/linux/async_process.py":[{"author":{"_account_id":8124,"name":"cbrandily","email":"zzelle@gmail.com","username":"cbrandily"},"change_message_id":"64f44920229742fa119e7f7147d9b143a8868368","unresolved":false,"context_lines":[{"line_number":227,"context_line":"        data \u003d stream.readline()"},{"line_number":228,"context_line":"        if data:"},{"line_number":229,"context_line":"            data \u003d data.strip()"},{"line_number":230,"context_line":"            queue.put(data.decode())"},{"line_number":231,"context_line":"            return data"},{"line_number":232,"context_line":""},{"line_number":233,"context_line":"    def _read_stdout(self):"}],"source_content_type":"text/x-python","patch_set":2,"id":"da85f559_f20b6222","line":230,"updated":"2015-11-11 13:16:47.000000000","message":"It seems we should be consistent with neutron.agent.linux/windows.utils.execute[1] way to decode \"raw\" input?\n\n[1] https://github.com/openstack/neutron/blob/669dcc41bb04b8c0e0b914d95b84321ecd44be69/neutron/agent/linux/utils.py#L122-L124","commit_id":"1932a557a3384f880537140ccca9f8f128de31b7"},{"author":{"_account_id":9656,"name":"Ihar Hrachyshka","email":"ihrachys@redhat.com","username":"ihrachys","status":"Red Hat Networking Systems Engineer"},"change_message_id":"46cb867a3cd38d9dddf2e1ad701d75f316b0a5da","unresolved":false,"context_lines":[{"line_number":227,"context_line":"        data \u003d stream.readline()"},{"line_number":228,"context_line":"        if data:"},{"line_number":229,"context_line":"            data \u003d data.strip()"},{"line_number":230,"context_line":"            queue.put(data.decode())"},{"line_number":231,"context_line":"            return data"},{"line_number":232,"context_line":""},{"line_number":233,"context_line":"    def _read_stdout(self):"}],"source_content_type":"text/x-python","patch_set":2,"id":"da85f559_66ecef29","line":230,"in_reply_to":"da85f559_13b35951","updated":"2015-11-14 16:04:39.000000000","message":"Done","commit_id":"1932a557a3384f880537140ccca9f8f128de31b7"},{"author":{"_account_id":8124,"name":"cbrandily","email":"zzelle@gmail.com","username":"cbrandily"},"change_message_id":"71a5b6946929e03bc6b232ebc57522ab6b902dd3","unresolved":false,"context_lines":[{"line_number":227,"context_line":"        data \u003d stream.readline()"},{"line_number":228,"context_line":"        if data:"},{"line_number":229,"context_line":"            data \u003d data.strip()"},{"line_number":230,"context_line":"            queue.put(data.decode())"},{"line_number":231,"context_line":"            return data"},{"line_number":232,"context_line":""},{"line_number":233,"context_line":"    def _read_stdout(self):"}],"source_content_type":"text/x-python","patch_set":2,"id":"da85f559_facecb2b","line":230,"in_reply_to":"da85f559_31123e0a","updated":"2015-11-11 22:23:33.000000000","message":"@Carl: There\u0027s a shortcut for that[1]\n\nhttps://help.github.com/articles/getting-permanent-links-to-files/#press-y-to-permalink-to-a-file-in-a-specific-commit\n\n@Ihar: safe_decode is a bit slower, complex and overkill when you want to decode utf8 with surrogateescape error management BUT i am not sure it\u0027s enough to avoid its usage even more if we hide it in a \"decode_utf8\" helper method.","commit_id":"1932a557a3384f880537140ccca9f8f128de31b7"},{"author":{"_account_id":6524,"name":"Henry Gessau","email":"HenryG@gessau.net","username":"gessau"},"change_message_id":"3fc0707b3609b7d8e45256e2f08e9a5c4e218c40","unresolved":false,"context_lines":[{"line_number":227,"context_line":"        data \u003d stream.readline()"},{"line_number":228,"context_line":"        if data:"},{"line_number":229,"context_line":"            data \u003d data.strip()"},{"line_number":230,"context_line":"            queue.put(data.decode())"},{"line_number":231,"context_line":"            return data"},{"line_number":232,"context_line":""},{"line_number":233,"context_line":"    def _read_stdout(self):"}],"source_content_type":"text/x-python","patch_set":2,"id":"da85f559_1ab70ff6","line":230,"in_reply_to":"da85f559_31123e0a","updated":"2015-11-11 17:20:55.000000000","message":"At the very least we should be checking for text vs. bytes here (see the unit test failure).\n\nI do not yet understand all the aspects of decoding text/bytes in py3k. Should be be decoding with \u0027surrogateescape\u0027 here? I hope Victor can guide us.","commit_id":"1932a557a3384f880537140ccca9f8f128de31b7"},{"author":{"_account_id":7448,"name":"Carl Baldwin","email":"carl@ecbaldwin.net","username":"carl-baldwin"},"change_message_id":"b5f2dbdefb80aec2dee9520a356f25e98f88d7f3","unresolved":false,"context_lines":[{"line_number":227,"context_line":"        data \u003d stream.readline()"},{"line_number":228,"context_line":"        if data:"},{"line_number":229,"context_line":"            data \u003d data.strip()"},{"line_number":230,"context_line":"            queue.put(data.decode())"},{"line_number":231,"context_line":"            return data"},{"line_number":232,"context_line":""},{"line_number":233,"context_line":"    def _read_stdout(self):"}],"source_content_type":"text/x-python","patch_set":2,"id":"da85f559_31123e0a","line":230,"in_reply_to":"da85f559_da3d10de","updated":"2015-11-11 16:33:20.000000000","message":"/me gives @Cedric kudos for using a real permalink in his comment.  ;)","commit_id":"1932a557a3384f880537140ccca9f8f128de31b7"},{"author":{"_account_id":9656,"name":"Ihar Hrachyshka","email":"ihrachys@redhat.com","username":"ihrachys","status":"Red Hat Networking Systems Engineer"},"change_message_id":"0ea2cc62139784aed3645aabb9c8cb8b674dde9a","unresolved":false,"context_lines":[{"line_number":227,"context_line":"        data \u003d stream.readline()"},{"line_number":228,"context_line":"        if data:"},{"line_number":229,"context_line":"            data \u003d data.strip()"},{"line_number":230,"context_line":"            queue.put(data.decode())"},{"line_number":231,"context_line":"            return data"},{"line_number":232,"context_line":""},{"line_number":233,"context_line":"    def _read_stdout(self):"}],"source_content_type":"text/x-python","patch_set":2,"id":"da85f559_da3d10de","line":230,"in_reply_to":"da85f559_f20b6222","updated":"2015-11-11 15:00:02.000000000","message":"I consider using oslo.utils\u0027 safe_decode. Is there any reason we did not use it for the code you refer to?","commit_id":"1932a557a3384f880537140ccca9f8f128de31b7"},{"author":{"_account_id":9107,"name":"Victor Stinner","email":"vstinner@redhat.com","username":"haypo"},"change_message_id":"f5a06bcc664b466febddd5c1573ebe091ac77b6a","unresolved":false,"context_lines":[{"line_number":227,"context_line":"        data \u003d stream.readline()"},{"line_number":228,"context_line":"        if data:"},{"line_number":229,"context_line":"            data \u003d data.strip()"},{"line_number":230,"context_line":"            queue.put(data.decode())"},{"line_number":231,"context_line":"            return data"},{"line_number":232,"context_line":""},{"line_number":233,"context_line":"    def _read_stdout(self):"}],"source_content_type":"text/x-python","patch_set":2,"id":"da85f559_13b35951","line":230,"in_reply_to":"da85f559_facecb2b","updated":"2015-11-12 09:00:57.000000000","message":"\"Should be be decoding with \u0027surrogateescape\u0027 here? I hope Victor can guide us.\"\n\nFirst, I don\u0027t think that it\u0027s good idea to decode on Python 2. I know that it\u0027s usually better to handle text as Unicode, but in practice you may get more issues with Unicode if you switch from bytes to Unicode in an existing project.\n\nSecond, bytes.decode() has a better behaviour on Python 2 (ASCII) and Python 3 (UTF-8): never call it without an explicit encoding.\n\nFor a subprocess, it\u0027s likely that you will get UnicodeDecodeError if the output is not strictly encoded to UTF-8. So yes, it\u0027s better to use the surrogateescape error handler.\n\nI suggest to use:\n\nif six.PY3 and isinstance(data, bytes):\n    data \u003d data.decode(\u0027utf-8\u0027, \u0027surrogateescape\u0027)\n\nAbout helpers: Python 3 provides os.fsdecode() which uses the locale encoding (sys.getfilesystemencoding() to be exact) with the surrogateecape error handler. In my experience, it\u0027s the best compromise for the maximum compatibility.\n\nIn OpenStack, I accept to use explicitly UTF-8 since you really want UTF-8, even if the locale is misconfigured (ex: not LANG env var set, so the locale encoding is usually ASCII).","commit_id":"1932a557a3384f880537140ccca9f8f128de31b7"}],"neutron/common/utils.py":[{"author":{"_account_id":14611,"name":"dasm","display_name":"dasm","email":"dsmigiel@redhat.com","username":"dasm"},"change_message_id":"b9764b9ce6158e80a2b5e7fa55b42aa9474a273f","unresolved":false,"context_lines":[{"line_number":526,"context_line":"    return class_to_load"},{"line_number":527,"context_line":""},{"line_number":528,"context_line":""},{"line_number":529,"context_line":"def safe_decode_utf8(s):"},{"line_number":530,"context_line":"    if six.PY3 and isinstance(s, bytes):"},{"line_number":531,"context_line":"        return s.decode(\u0027utf-8\u0027, \u0027surrogateescape\u0027)"},{"line_number":532,"context_line":"    return s"}],"source_content_type":"text/x-python","patch_set":3,"id":"da85f559_66f14f6a","line":529,"updated":"2015-11-14 17:23:38.000000000","message":"Nice thing with removing from the other two modules!","commit_id":"f754db7140c52b2aa3e1c14df520a67729b8ebb8"}],"neutron/tests/unit/agent/linux/test_utils.py":[{"author":{"_account_id":14611,"name":"dasm","display_name":"dasm","email":"dsmigiel@redhat.com","username":"dasm"},"change_message_id":"b9764b9ce6158e80a2b5e7fa55b42aa9474a273f","unresolved":false,"context_lines":[{"line_number":148,"context_line":"        result \u003d utils.execute([\u0027ls\u0027, self.test_file], return_stderr\u003dTrue)"},{"line_number":149,"context_line":"        self.assertEqual((str_data, \u0027\u0027), result)"},{"line_number":150,"context_line":""},{"line_number":151,"context_line":"    @helpers.requires_py3"},{"line_number":152,"context_line":"    def test_surrogateescape_in_decoding_out_data(self):"},{"line_number":153,"context_line":"        bytes_err_data \u003d b\u0027\\xed\\xa0\\xbd\u0027"},{"line_number":154,"context_line":"        err_data \u003d bytes_err_data.decode(\u0027utf-8\u0027, \u0027surrogateescape\u0027)"}],"source_content_type":"text/x-python","patch_set":3,"id":"da85f559_86fc733f","line":151,"updated":"2015-11-14 17:23:38.000000000","message":"+1","commit_id":"f754db7140c52b2aa3e1c14df520a67729b8ebb8"}],"neutron/tests/unit/common/test_utils.py":[{"author":{"_account_id":14611,"name":"dasm","display_name":"dasm","email":"dsmigiel@redhat.com","username":"dasm"},"change_message_id":"b9764b9ce6158e80a2b5e7fa55b42aa9474a273f","unresolved":false,"context_lines":[{"line_number":736,"context_line":""},{"line_number":737,"context_line":"    @helpers.requires_py3"},{"line_number":738,"context_line":"    def test_py3_decoded_invalid_bytes(self):"},{"line_number":739,"context_line":"        s \u003d bytes(\u0027test-py2\u0027, \u0027utf_16\u0027)"},{"line_number":740,"context_line":"        decoded_str \u003d utils.safe_decode_utf8(s)"},{"line_number":741,"context_line":"        self.assertIsInstance(decoded_str, six.text_type)"}],"source_content_type":"text/x-python","patch_set":3,"id":"da85f559_a1188176","line":739,"updated":"2015-11-14 17:23:38.000000000","message":"Above you\u0027ve used \"utf-8\". Would be nice to be consistent and use \"utf-16\".","commit_id":"f754db7140c52b2aa3e1c14df520a67729b8ebb8"},{"author":{"_account_id":14611,"name":"dasm","display_name":"dasm","email":"dsmigiel@redhat.com","username":"dasm"},"change_message_id":"b9764b9ce6158e80a2b5e7fa55b42aa9474a273f","unresolved":false,"context_lines":[{"line_number":738,"context_line":"    def test_py3_decoded_invalid_bytes(self):"},{"line_number":739,"context_line":"        s \u003d bytes(\u0027test-py2\u0027, \u0027utf_16\u0027)"},{"line_number":740,"context_line":"        decoded_str \u003d utils.safe_decode_utf8(s)"},{"line_number":741,"context_line":"        self.assertIsInstance(decoded_str, six.text_type)"}],"source_content_type":"text/x-python","patch_set":3,"id":"da85f559_e6077f1b","line":741,"updated":"2015-11-14 17:23:38.000000000","message":"Correct me, if I\u0027m wrong but I believe, it won\u0027t work: http://paste.openstack.org/show/478865/\n\nYou\u0027ll have encoded string, but it won\u0027t be valid one.","commit_id":"f754db7140c52b2aa3e1c14df520a67729b8ebb8"},{"author":{"_account_id":9656,"name":"Ihar Hrachyshka","email":"ihrachys@redhat.com","username":"ihrachys","status":"Red Hat Networking Systems Engineer"},"change_message_id":"09fe33efa083d164727331cb4f151e53995e74d1","unresolved":false,"context_lines":[{"line_number":738,"context_line":"    def test_py3_decoded_invalid_bytes(self):"},{"line_number":739,"context_line":"        s \u003d bytes(\u0027test-py2\u0027, \u0027utf_16\u0027)"},{"line_number":740,"context_line":"        decoded_str \u003d utils.safe_decode_utf8(s)"},{"line_number":741,"context_line":"        self.assertIsInstance(decoded_str, six.text_type)"}],"source_content_type":"text/x-python","patch_set":3,"id":"ba8a016a_e61e58ba","line":741,"in_reply_to":"da85f559_4c3a21cf","updated":"2015-11-18 15:57:42.000000000","message":"It\u0027s not valid in a way that it\u0027s not printable, but it\u0027s still a valid \u0027unicode\u0027 object.","commit_id":"f754db7140c52b2aa3e1c14df520a67729b8ebb8"},{"author":{"_account_id":14611,"name":"dasm","display_name":"dasm","email":"dsmigiel@redhat.com","username":"dasm"},"change_message_id":"ce21d8a904b5eac3c3a541493d910fccf17962fd","unresolved":false,"context_lines":[{"line_number":738,"context_line":"    def test_py3_decoded_invalid_bytes(self):"},{"line_number":739,"context_line":"        s \u003d bytes(\u0027test-py2\u0027, \u0027utf_16\u0027)"},{"line_number":740,"context_line":"        decoded_str \u003d utils.safe_decode_utf8(s)"},{"line_number":741,"context_line":"        self.assertIsInstance(decoded_str, six.text_type)"}],"source_content_type":"text/x-python","patch_set":3,"id":"da85f559_4c3a21cf","line":741,"in_reply_to":"da85f559_61d37960","updated":"2015-11-15 15:35:13.000000000","message":"OK, gotcha... but the output is not valid. If you\u0027re (and the others) OK with this, I\u0027m also... but probably we should be aware that utf-16 !\u003d utf-8.","commit_id":"f754db7140c52b2aa3e1c14df520a67729b8ebb8"},{"author":{"_account_id":9656,"name":"Ihar Hrachyshka","email":"ihrachys@redhat.com","username":"ihrachys","status":"Red Hat Networking Systems Engineer"},"change_message_id":"615181b76adf1ece0561eddfef5fe6d41f02cac8","unresolved":false,"context_lines":[{"line_number":738,"context_line":"    def test_py3_decoded_invalid_bytes(self):"},{"line_number":739,"context_line":"        s \u003d bytes(\u0027test-py2\u0027, \u0027utf_16\u0027)"},{"line_number":740,"context_line":"        decoded_str \u003d utils.safe_decode_utf8(s)"},{"line_number":741,"context_line":"        self.assertIsInstance(decoded_str, six.text_type)"}],"source_content_type":"text/x-python","patch_set":3,"id":"da85f559_61d37960","line":741,"in_reply_to":"da85f559_e6077f1b","updated":"2015-11-14 17:38:40.000000000","message":"The point of the test is validating that it does not crash on garbage in the bytes string, and still returns some data that corresponds to the bytes on best effort.","commit_id":"f754db7140c52b2aa3e1c14df520a67729b8ebb8"}]}
