{"action":"created","issue":{"url":"https://api.github.com/repos/brython-dev/brython/issues/109","labels_url":"https://api.github.com/repos/brython-dev/brython/issues/109/labels{/name}","comments_url":"https://api.github.com/repos/brython-dev/brython/issues/109/comments","events_url":"https://api.github.com/repos/brython-dev/brython/issues/109/events","html_url":"https://github.com/brython-dev/brython/issues/109","id":54818675,"number":109,"title":"Brython dict() can't handle nested JS Object Literals (dict's)","user":{"login":"cforger","id":874262,"avatar_url":"https://avatars.githubusercontent.com/u/874262?v=3","gravatar_id":"","url":"https://api.github.com/users/cforger","html_url":"https://github.com/cforger","followers_url":"https://api.github.com/users/cforger/followers","following_url":"https://api.github.com/users/cforger/following{/other_user}","gists_url":"https://api.github.com/users/cforger/gists{/gist_id}","starred_url":"https://api.github.com/users/cforger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cforger/subscriptions","organizations_url":"https://api.github.com/users/cforger/orgs","repos_url":"https://api.github.com/users/cforger/repos","events_url":"https://api.github.com/users/cforger/events{/privacy}","received_events_url":"https://api.github.com/users/cforger/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":35,"created_at":"2015-01-19T22:10:47Z","updated_at":"2015-01-22T20:23:17Z","closed_at":null,"body":"Hello,\r\n\r\n I've attempted correcting this in the source, but I'm too new to Brython to make sure I'm doing a good job - I see the creation of a dict requires issues with future updates to the JSObj, etc.\r\n\r\n The problem is simple to replicate. Assuming an Object Literal from a function like this:\r\n\r\n    do_list = function(){\r\n        return {1:'one', 2:'two', 3:'three', 4:{ 'big_bad_wolf':1 }}\r\n    }\r\n\r\nin Brython:\r\n\r\n  js_dict = window.do_list()\r\n  print(js_dict)\r\n\r\nI see in line 304 of py_dict.js looping across the object, assigning the value to the new dict. \r\nEverything is fine until it hits item 4, where I see it assigns an Object to the value, so it's packing an un-wrapped JS Object into the brython dict.\r\n\r\nThe error is expressed as:\r\n\r\nUncaught Error: TypeError: Cannot read property '__mro__' of undefined\r\n\r\n.. depending on how I'm accessing the dict, because it can't find what it for that object. \r\n\r\n\r\nIf someone with more skill with Brython could fix this for me, I'd appreciate it.  \r\n\r\nThanks.\r\n"},"comment":{"url":"https://api.github.com/repos/brython-dev/brython/issues/comments/71091648","html_url":"https://github.com/brython-dev/brython/issues/109#issuecomment-71091648","issue_url":"https://api.github.com/repos/brython-dev/brython/issues/109","id":71091648,"user":{"login":"PierreQuentel","id":3447215,"avatar_url":"https://avatars.githubusercontent.com/u/3447215?v=3","gravatar_id":"","url":"https://api.github.com/users/PierreQuentel","html_url":"https://github.com/PierreQuentel","followers_url":"https://api.github.com/users/PierreQuentel/followers","following_url":"https://api.github.com/users/PierreQuentel/following{/other_user}","gists_url":"https://api.github.com/users/PierreQuentel/gists{/gist_id}","starred_url":"https://api.github.com/users/PierreQuentel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PierreQuentel/subscriptions","organizations_url":"https://api.github.com/users/PierreQuentel/orgs","repos_url":"https://api.github.com/users/PierreQuentel/repos","events_url":"https://api.github.com/users/PierreQuentel/events{/privacy}","received_events_url":"https://api.github.com/users/PierreQuentel/received_events","type":"User","site_admin":false},"created_at":"2015-01-22T20:23:17Z","updated_at":"2015-01-22T20:23:17Z","body":"James,\r\n\r\nI have the same error message in the browser console, but no exception is raised in Brython interactive interpreter (console.html). \r\n\r\nIt's the interactive interpreter that tries to evaluate the code `a = 5` ; if the code is an expression, the name `_` is set to the value of this expression, as in CPython console. \r\n\r\nTo test if the code is an expression, the interactive interpreter tries an `eval()` on the code ; if it fails, an error is printed on the interactive console, but this exception is caught and the interpreter runs the code with `exec()`\r\n\r\nMaybe caught exceptions could be handled in a way that they don't print anything in the browser console. But what really counts is the exceptions reported in the interpreter"}}