)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":1669,"name":"Julien Danjou","display_name":"jd","email":"julien@danjou.info","username":"jdanjou"},"change_message_id":"c07c37b962b3a01dbfb6f8ebb08e3944b8458ada","unresolved":false,"context_lines":[{"line_number":10,"context_line":"serialialization error like \"ValueError: Circular reference detected\""},{"line_number":11,"context_line":"when using the JSONFormatter of oslo.log."},{"line_number":12,"context_line":""},{"line_number":13,"context_line":"Or use fallback\u003dsix.tex_type to convert objects to text."},{"line_number":14,"context_line":""},{"line_number":15,"context_line":"Related-Bug: #1593641"},{"line_number":16,"context_line":"Change-Id: Ie0f7f2d09355c3d2a9f7c5ee8f7e02dfea3b073b"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":3,"id":"5f2577a7_6a285ce1","line":13,"range":{"start_line":13,"start_character":20,"end_line":13,"end_character":28},"updated":"2017-09-14 09:02:31.000000000","message":"typo","commit_id":"8a7c33448f2afbf30ea00b3806b054803aeaccf4"},{"author":{"_account_id":9107,"name":"Victor Stinner","email":"vstinner@redhat.com","username":"haypo"},"change_message_id":"ebf7c062dcfeebfe71c6b885f40748097a1abf74","unresolved":false,"context_lines":[{"line_number":10,"context_line":"serialialization error like \"ValueError: Circular reference detected\""},{"line_number":11,"context_line":"when using the JSONFormatter of oslo.log."},{"line_number":12,"context_line":""},{"line_number":13,"context_line":"Or use fallback\u003dsix.tex_type to convert objects to text."},{"line_number":14,"context_line":""},{"line_number":15,"context_line":"Related-Bug: #1593641"},{"line_number":16,"context_line":"Change-Id: Ie0f7f2d09355c3d2a9f7c5ee8f7e02dfea3b073b"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":3,"id":"5f2577a7_b72468b0","line":13,"range":{"start_line":13,"start_character":20,"end_line":13,"end_character":28},"in_reply_to":"5f2577a7_6a285ce1","updated":"2017-09-14 15:52:31.000000000","message":"fixed","commit_id":"8a7c33448f2afbf30ea00b3806b054803aeaccf4"},{"author":{"_account_id":9796,"name":"ChangBo Guo","email":"glongwave@gmail.com","username":"gcb"},"change_message_id":"d62934dab49c87850a5dac00481e3ec1b9d23dff","unresolved":false,"context_lines":[{"line_number":7,"context_line":"jsonutils.to_primitive(): add fallback parameter"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"For example, to_primitive(fallback\u003drepr) can be used to prevent"},{"line_number":10,"context_line":"serialialization error like \"ValueError: Circular reference detected\""},{"line_number":11,"context_line":"when using the JSONFormatter of oslo.log."},{"line_number":12,"context_line":""},{"line_number":13,"context_line":"Or use fallback\u003dsix.text_type to convert objects to text."}],"source_content_type":"text/x-gerrit-commit-message","patch_set":4,"id":"5f2577a7_0493ec5c","line":10,"range":{"start_line":10,"start_character":0,"end_line":10,"end_character":69},"updated":"2017-09-15 15:47:20.000000000","message":"We try to raise ValueError directly in the future, current will try to warn caller\u0027s the issue in https://review.openstack.org/#/c/496067","commit_id":"53c3ba0b9a8191ec5689b6cc0e1803f7b3d94c7f"},{"author":{"_account_id":9107,"name":"Victor Stinner","email":"vstinner@redhat.com","username":"haypo"},"change_message_id":"6268060e1f729d1111395a11a49f365cf1551753","unresolved":false,"context_lines":[{"line_number":7,"context_line":"jsonutils.to_primitive(): add fallback parameter"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"For example, to_primitive(fallback\u003drepr) can be used to prevent"},{"line_number":10,"context_line":"serialialization error like \"ValueError: Circular reference detected\""},{"line_number":11,"context_line":"when using the JSONFormatter of oslo.log."},{"line_number":12,"context_line":""},{"line_number":13,"context_line":"Or use fallback\u003dsix.text_type to convert objects to text."}],"source_content_type":"text/x-gerrit-commit-message","patch_set":4,"id":"ff5d4b2f_7199e71d","line":10,"range":{"start_line":10,"start_character":0,"end_line":10,"end_character":69},"in_reply_to":"1f2f7f8d_2ee9c77f","updated":"2017-09-19 10:04:02.000000000","message":"Oh, I see. Let me give you a little bit more context.\n\nA customer wants to use the oslo.log JSONFormatter. Problem: the log fails on volume creation in Cinder on a simple log which looks like LOG.info(\"hosts\u003d%s\", hosts). str(hosts) works fine, but jsonutils.dumps(hosts) fail with \"ValueError: Circular reference detected\".\n\nNew problem: my colleague working on Cinder doesn\u0027t want to fix the code just for a special oslo.log formatter. (I don\u0027t think that the JSONFormatter is widely used, since it fails on simple Cinder operation.)\n\nHonestly, I don\u0027t see how to easily modify the log line in Cinder to fix the JSON formatter. to_primitive() has no protocol like calling a to_primitive() *method*.\n\nMoreover, I don\u0027t think that deserialization in oslo.log is expected to retrieve working Python objects. The JSON formatter can be used to collect much more details than just the error message, like the pid, thread identifier, timestamp, etc.\n\nI mean, it\u0027s nice to have the \"args\" key containing the best representation of LOG.info() arguments, but I wouldn\u0027t say that it\u0027s a requirement (in my opinion).\n\nSee the change Ibda7d145af95903b2bf8d87113804350330a93b4 for a concrete fix for oslo.log: use to_primitive(fallback\u003drepr) to prevent JSON serialization errors on logging.","commit_id":"53c3ba0b9a8191ec5689b6cc0e1803f7b3d94c7f"},{"author":{"_account_id":9107,"name":"Victor Stinner","email":"vstinner@redhat.com","username":"haypo"},"change_message_id":"d02f2831b2d50c3487d88275ba9bcbf5551d48e7","unresolved":false,"context_lines":[{"line_number":7,"context_line":"jsonutils.to_primitive(): add fallback parameter"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"For example, to_primitive(fallback\u003drepr) can be used to prevent"},{"line_number":10,"context_line":"serialialization error like \"ValueError: Circular reference detected\""},{"line_number":11,"context_line":"when using the JSONFormatter of oslo.log."},{"line_number":12,"context_line":""},{"line_number":13,"context_line":"Or use fallback\u003dsix.text_type to convert objects to text."}],"source_content_type":"text/x-gerrit-commit-message","patch_set":4,"id":"5f2577a7_3de820e0","line":10,"range":{"start_line":10,"start_character":0,"end_line":10,"end_character":69},"in_reply_to":"5f2577a7_0493ec5c","updated":"2017-09-18 09:36:01.000000000","message":"\u003e We try to raise ValueError directly in the future, current will try to warn caller\u0027s the issue in https://review.openstack.org/#/c/496067\n\nA warning would be very useful, but without my fallback parameter or something else, I don\u0027t see how the consumer of the API is supposed to fix the warning?","commit_id":"53c3ba0b9a8191ec5689b6cc0e1803f7b3d94c7f"},{"author":{"_account_id":9107,"name":"Victor Stinner","email":"vstinner@redhat.com","username":"haypo"},"change_message_id":"04567f0007416896f49b553f23b7513d9f7e8e56","unresolved":false,"context_lines":[{"line_number":7,"context_line":"jsonutils.to_primitive(): add fallback parameter"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"For example, to_primitive(fallback\u003drepr) can be used to prevent"},{"line_number":10,"context_line":"serialialization error like \"ValueError: Circular reference detected\""},{"line_number":11,"context_line":"when using the JSONFormatter of oslo.log."},{"line_number":12,"context_line":""},{"line_number":13,"context_line":"Or use fallback\u003dsix.text_type to convert objects to text."}],"source_content_type":"text/x-gerrit-commit-message","patch_set":4,"id":"5f2577a7_5d864c15","line":10,"range":{"start_line":10,"start_character":0,"end_line":10,"end_character":69},"in_reply_to":"5f2577a7_3de820e0","updated":"2017-09-18 09:39:42.000000000","message":"So ChangBo, what do you think of my change? Does it look good to you? I\u0027m not sure that I understood correctly the intend of your comment.","commit_id":"53c3ba0b9a8191ec5689b6cc0e1803f7b3d94c7f"},{"author":{"_account_id":9796,"name":"ChangBo Guo","email":"glongwave@gmail.com","username":"gcb"},"change_message_id":"01c2c463f9ba95fe9837575622a68b071aea9f71","unresolved":false,"context_lines":[{"line_number":7,"context_line":"jsonutils.to_primitive(): add fallback parameter"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"For example, to_primitive(fallback\u003drepr) can be used to prevent"},{"line_number":10,"context_line":"serialialization error like \"ValueError: Circular reference detected\""},{"line_number":11,"context_line":"when using the JSONFormatter of oslo.log."},{"line_number":12,"context_line":""},{"line_number":13,"context_line":"Or use fallback\u003dsix.text_type to convert objects to text."}],"source_content_type":"text/x-gerrit-commit-message","patch_set":4,"id":"1f2f7f8d_2ee9c77f","line":10,"range":{"start_line":10,"start_character":0,"end_line":10,"end_character":69},"in_reply_to":"5f2577a7_5d864c15","updated":"2017-09-19 01:49:02.000000000","message":"Method to_primitive is usually used to serialize object before sending the object in the RPC and how to represent the object when loading from json ? if we just provide the workround to pass this method, IMO, we\u0027d better raise Value to notify the error instead of suppressing the error.","commit_id":"53c3ba0b9a8191ec5689b6cc0e1803f7b3d94c7f"},{"author":{"_account_id":2472,"name":"Doug Hellmann","email":"dhellmann@redhat.com","username":"doug-hellmann"},"change_message_id":"5096e7a397d82ff2e78766f10046eedf25212566","unresolved":false,"context_lines":[{"line_number":7,"context_line":"jsonutils.to_primitive(): add fallback parameter"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"For example, to_primitive(fallback\u003drepr) can be used to prevent"},{"line_number":10,"context_line":"serialialization error like \"ValueError: Circular reference detected\""},{"line_number":11,"context_line":"when using the JSONFormatter of oslo.log."},{"line_number":12,"context_line":""},{"line_number":13,"context_line":"Or use fallback\u003dsix.text_type to convert objects to text."}],"source_content_type":"text/x-gerrit-commit-message","patch_set":4,"id":"ff5d4b2f_0c5cc549","line":10,"range":{"start_line":10,"start_character":0,"end_line":10,"end_character":69},"in_reply_to":"ff5d4b2f_7199e71d","updated":"2017-09-19 16:49:24.000000000","message":"\u003e A customer wants to use the oslo.log JSONFormatter. Problem: the\n \u003e log fails on volume creation in Cinder on a simple log which looks\n \u003e like LOG.info(\"hosts\u003d%s\", hosts). str(hosts) works fine, but\n \u003e jsonutils.dumps(hosts) fail with \"ValueError: Circular reference\n \u003e detected\".\n\nI\u0027m not sure I see how the tests added for this patch would reproduce the circular reference conditions you describe.\n\n \u003e Honestly, I don\u0027t see how to easily modify the log line in Cinder\n \u003e to fix the JSON formatter. to_primitive() has no protocol like\n \u003e calling a to_primitive() *method*.\n\nIf hosts is just a list of strings, it should work fine. I\u0027m curious about what hosts is actually set to.","commit_id":"53c3ba0b9a8191ec5689b6cc0e1803f7b3d94c7f"}],"oslo_serialization/jsonutils.py":[{"author":{"_account_id":1669,"name":"Julien Danjou","display_name":"jd","email":"julien@danjou.info","username":"jdanjou"},"change_message_id":"c07c37b962b3a01dbfb6f8ebb08e3944b8458ada","unresolved":false,"context_lines":[{"line_number":58,"context_line":""},{"line_number":59,"context_line":"def to_primitive(value, convert_instances\u003dFalse, convert_datetime\u003dTrue,"},{"line_number":60,"context_line":"                 level\u003d0, max_depth\u003d3, encoding\u003d\u0027utf-8\u0027,"},{"line_number":61,"context_line":"                 fallback\u003dNone):"},{"line_number":62,"context_line":"    \"\"\"Convert a complex object into primitives."},{"line_number":63,"context_line":""},{"line_number":64,"context_line":"    Handy for JSON serialization. We can optionally handle instances,"}],"source_content_type":"text/x-python","patch_set":3,"id":"5f2577a7_2a225401","line":61,"updated":"2017-09-14 09:02:31.000000000","message":"you could do fallback\u003dsix.text_type and save a if :)","commit_id":"8a7c33448f2afbf30ea00b3806b054803aeaccf4"},{"author":{"_account_id":9107,"name":"Victor Stinner","email":"vstinner@redhat.com","username":"haypo"},"change_message_id":"ebf7c062dcfeebfe71c6b885f40748097a1abf74","unresolved":false,"context_lines":[{"line_number":58,"context_line":""},{"line_number":59,"context_line":"def to_primitive(value, convert_instances\u003dFalse, convert_datetime\u003dTrue,"},{"line_number":60,"context_line":"                 level\u003d0, max_depth\u003d3, encoding\u003d\u0027utf-8\u0027,"},{"line_number":61,"context_line":"                 fallback\u003dNone):"},{"line_number":62,"context_line":"    \"\"\"Convert a complex object into primitives."},{"line_number":63,"context_line":""},{"line_number":64,"context_line":"    Handy for JSON serialization. We can optionally handle instances,"}],"source_content_type":"text/x-python","patch_set":3,"id":"5f2577a7_573304f7","line":61,"in_reply_to":"5f2577a7_2a225401","updated":"2017-09-14 15:52:31.000000000","message":"No, I don\u0027t want to change the default behaviour. You know, if you touch anything, you break OpenStack. That\u0027s life.","commit_id":"8a7c33448f2afbf30ea00b3806b054803aeaccf4"},{"author":{"_account_id":9535,"name":"Gorka Eguileor","email":"geguileo@redhat.com","username":"Gorka"},"change_message_id":"ac3482733dfa875f8dea9651ea737c29d06625cd","unresolved":false,"context_lines":[{"line_number":58,"context_line":""},{"line_number":59,"context_line":"def to_primitive(value, convert_instances\u003dFalse, convert_datetime\u003dTrue,"},{"line_number":60,"context_line":"                 level\u003d0, max_depth\u003d3, encoding\u003d\u0027utf-8\u0027,"},{"line_number":61,"context_line":"                 fallback\u003dNone):"},{"line_number":62,"context_line":"    \"\"\"Convert a complex object into primitives."},{"line_number":63,"context_line":""},{"line_number":64,"context_line":"    Handy for JSON serialization. We can optionally handle instances,"}],"source_content_type":"text/x-python","patch_set":3,"id":"5f2577a7_718730b7","line":61,"in_reply_to":"5f2577a7_2a225401","updated":"2017-09-14 15:21:08.000000000","message":"that would only work if fallback is not passed, if `fallback\u003dNone` is passed it would break.","commit_id":"8a7c33448f2afbf30ea00b3806b054803aeaccf4"},{"author":{"_account_id":1669,"name":"Julien Danjou","display_name":"jd","email":"julien@danjou.info","username":"jdanjou"},"change_message_id":"b0fdae566cd3b1e00e34df687ed1829edccf0db1","unresolved":false,"context_lines":[{"line_number":58,"context_line":""},{"line_number":59,"context_line":"def to_primitive(value, convert_instances\u003dFalse, convert_datetime\u003dTrue,"},{"line_number":60,"context_line":"                 level\u003d0, max_depth\u003d3, encoding\u003d\u0027utf-8\u0027,"},{"line_number":61,"context_line":"                 fallback\u003dNone):"},{"line_number":62,"context_line":"    \"\"\"Convert a complex object into primitives."},{"line_number":63,"context_line":""},{"line_number":64,"context_line":"    Handy for JSON serialization. We can optionally handle instances,"}],"source_content_type":"text/x-python","patch_set":3,"id":"5f2577a7_374f5835","line":61,"in_reply_to":"5f2577a7_573304f7","updated":"2017-09-14 15:56:50.000000000","message":"Ah right Victor I missed the final return :)","commit_id":"8a7c33448f2afbf30ea00b3806b054803aeaccf4"},{"author":{"_account_id":1669,"name":"Julien Danjou","display_name":"jd","email":"julien@danjou.info","username":"jdanjou"},"change_message_id":"b62af485d98a067348369718faa3b1078679bf06","unresolved":false,"context_lines":[{"line_number":58,"context_line":""},{"line_number":59,"context_line":"def to_primitive(value, convert_instances\u003dFalse, convert_datetime\u003dTrue,"},{"line_number":60,"context_line":"                 level\u003d0, max_depth\u003d3, encoding\u003d\u0027utf-8\u0027,"},{"line_number":61,"context_line":"                 fallback\u003dNone):"},{"line_number":62,"context_line":"    \"\"\"Convert a complex object into primitives."},{"line_number":63,"context_line":""},{"line_number":64,"context_line":"    Handy for JSON serialization. We can optionally handle instances,"}],"source_content_type":"text/x-python","patch_set":3,"id":"5f2577a7_2ca6eb54","line":61,"in_reply_to":"5f2577a7_718730b7","updated":"2017-09-14 15:46:35.000000000","message":"If you don\u0027t pass fallback it\u0027d be six.text_type, so that\u0027d be the same.\n\nObviously fallback\u003dNone would not work since None is not callable and you want fallback to be callable…","commit_id":"8a7c33448f2afbf30ea00b3806b054803aeaccf4"},{"author":{"_account_id":9535,"name":"Gorka Eguileor","email":"geguileo@redhat.com","username":"Gorka"},"change_message_id":"ac3482733dfa875f8dea9651ea737c29d06625cd","unresolved":false,"context_lines":[{"line_number":175,"context_line":"        # __iter__ defined but it isn\u0027t callable as list()."},{"line_number":176,"context_line":"        if fallback is not None:"},{"line_number":177,"context_line":"            return fallback(value)"},{"line_number":178,"context_line":"        else:"},{"line_number":179,"context_line":"            return six.text_type(value)"},{"line_number":180,"context_line":""},{"line_number":181,"context_line":"    if fallback is not None:"}],"source_content_type":"text/x-python","patch_set":3,"id":"5f2577a7_9105fc48","line":178,"updated":"2017-09-14 15:21:08.000000000","message":"`else` is not needed here","commit_id":"8a7c33448f2afbf30ea00b3806b054803aeaccf4"},{"author":{"_account_id":9796,"name":"ChangBo Guo","email":"glongwave@gmail.com","username":"gcb"},"change_message_id":"386f9aabcf20b87577ca195ec720995fee0c0e40","unresolved":false,"context_lines":[{"line_number":75,"context_line":"    If the object cannot be converted to primitive, it is returned unchanged"},{"line_number":76,"context_line":"    if fallback is not set, return fallback(value) otherwise."},{"line_number":77,"context_line":""},{"line_number":78,"context_line":"    .. versionchanged:: 2.21"},{"line_number":79,"context_line":"       Added *fallback* parameter."},{"line_number":80,"context_line":""},{"line_number":81,"context_line":"    .. versionchanged:: 1.3"}],"source_content_type":"text/x-python","patch_set":6,"id":"7f515b1d_6346677f","line":78,"range":{"start_line":78,"start_character":24,"end_line":78,"end_character":28},"updated":"2017-09-26 01:48:38.000000000","message":"we just released 2.21, need change to 2.22","commit_id":"faa6de323bd943171cbac6ad3dbd3749dea1935c"}]}
