{"action":"created","issue":{"url":"https://api.github.com/repos/brython-dev/brython/issues/305","labels_url":"https://api.github.com/repos/brython-dev/brython/issues/305/labels{/name}","comments_url":"https://api.github.com/repos/brython-dev/brython/issues/305/comments","events_url":"https://api.github.com/repos/brython-dev/brython/issues/305/events","html_url":"https://github.com/brython-dev/brython/issues/305","id":108945130,"number":305,"title":"for in has extra and missing line_info depending on the case","user":{"login":"amrdraz","id":1708559,"avatar_url":"https://avatars.githubusercontent.com/u/1708559?v=3","gravatar_id":"","url":"https://api.github.com/users/amrdraz","html_url":"https://github.com/amrdraz","followers_url":"https://api.github.com/users/amrdraz/followers","following_url":"https://api.github.com/users/amrdraz/following{/other_user}","gists_url":"https://api.github.com/users/amrdraz/gists{/gist_id}","starred_url":"https://api.github.com/users/amrdraz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amrdraz/subscriptions","organizations_url":"https://api.github.com/users/amrdraz/orgs","repos_url":"https://api.github.com/users/amrdraz/repos","events_url":"https://api.github.com/users/amrdraz/events{/privacy}","received_events_url":"https://api.github.com/users/amrdraz/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-09-29T19:46:21Z","updated_at":"2015-09-29T19:48:57Z","closed_at":null,"body":"![screen shot 2015-09-29 at 9 31 23 pm](https://cloud.githubusercontent.com/assets/1708559/10175899/d5c808b0-66f1-11e5-877e-5ce6fe58583d.png)\r\n\r\nSo if you have a for in with a iterator\r\n\r\n    l = [2,3,55,6]\r\n    for i in l:\r\n        print(i)\r\n\r\nyou would get 2 line_info trace set before the loop starts\r\n\r\n```    \r\n    $locals___main__[\"l\"]=[2,3,55,6];\r\n    ;$locals.$line_info=\"3,__main__\";\r\n    $locals[\"$next96\"]=getattr(iter($locals___main__[\"l\"]),\"__next__\");\r\n\r\n    ;$locals.$line_info=\"3,__main__\";\r\nwhile(1) {\r\n try{\r\n        $locals___main__[\"i\"]=$locals[\"$next96\"]();\r\n    }\r\n    catch($err){if($B.is_exc($err,[StopIteration])){delete $locals[\"$next96\"];break;}else{throw($err)}}\r\n    ;$locals.$line_info=\"4,__main__\";\r\n    getattr(print,\"__call__\")($locals___main__[\"i\"]);\r\n    $locals.$line_info=\"3,__main__\";\r\n}\r\n```\r\n\r\n\r\nand if you have for in called on a function that returns an iterator _specifically range()_\r\n\r\n```\r\nfor i in range(len(l)):\r\n    print(l[i])\r\n```\r\n\r\nyou get\r\n\r\n```\r\n;$locals.$line_info=\"7,__main__\";\r\nfunction $f97(){\r\n    $locals___main__[\"i\"]=0;\r\n    var $stop_97=$B.$GetInt(getattr(len,\"__call__\")($locals___main__[\"l\"])),\r\n        $next97= $locals___main__[\"i\"],\r\n        $safe97= typeof $next97==\"number\" && typeof $stop_97==\"number\";\r\n    while(true){\r\n        if($safe97 && $next97>= $stop_97){break}\r\n        else if(!$safe97 && $B.ge($next97, $stop_97)){break}\r\n        $locals___main__[\"i\"] = $next97\r\n        if($safe97){$next97+=1}\r\n        else{$next97=$B.add($next97,1)}\r\n        ;$locals.$line_info=\"8,__main__\";\r\n        getattr(print,\"__call__\")($B.list_key($locals___main__[\"l\"], $locals___main__[\"i\"]));\r\n    }\r\n}\r\nvar $res97=$f97();\r\n```\r\n\r\nwhich does not append a `;$locals.$line_info=\"7,__main__\";` before the end of the generated while loop like every other loop"},"comment":{"url":"https://api.github.com/repos/brython-dev/brython/issues/comments/144169050","html_url":"https://github.com/brython-dev/brython/issues/305#issuecomment-144169050","issue_url":"https://api.github.com/repos/brython-dev/brython/issues/305","id":144169050,"user":{"login":"amrdraz","id":1708559,"avatar_url":"https://avatars.githubusercontent.com/u/1708559?v=3","gravatar_id":"","url":"https://api.github.com/users/amrdraz","html_url":"https://github.com/amrdraz","followers_url":"https://api.github.com/users/amrdraz/followers","following_url":"https://api.github.com/users/amrdraz/following{/other_user}","gists_url":"https://api.github.com/users/amrdraz/gists{/gist_id}","starred_url":"https://api.github.com/users/amrdraz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/amrdraz/subscriptions","organizations_url":"https://api.github.com/users/amrdraz/orgs","repos_url":"https://api.github.com/users/amrdraz/repos","events_url":"https://api.github.com/users/amrdraz/events{/privacy}","received_events_url":"https://api.github.com/users/amrdraz/received_events","type":"User","site_admin":false},"created_at":"2015-09-29T19:48:57Z","updated_at":"2015-09-29T19:48:57Z","body":"it really isn't an issue that causes any error other than make my debugger rely on small quirks and special cases than just trace based on the appearance of line_infos\r\n\r\nunlike the other similar issue I had reported with the while loop, with the for loop there probably won't be an issue other than inconsistency of code output with the current state of affairs. errors will probably always be reported correctly"}}