{"action":"created","issue":{"url":"https://api.github.com/repos/pyflakes/pyflakes/issues/20","labels_url":"https://api.github.com/repos/pyflakes/pyflakes/issues/20/labels{/name}","comments_url":"https://api.github.com/repos/pyflakes/pyflakes/issues/20/comments","events_url":"https://api.github.com/repos/pyflakes/pyflakes/issues/20/events","html_url":"https://github.com/pyflakes/pyflakes/pull/20","id":81654540,"number":20,"title":"Checking for non-ast syntax errors","user":{"login":"asmeurer","id":71486,"avatar_url":"https://avatars.githubusercontent.com/u/71486?v=3","gravatar_id":"","url":"https://api.github.com/users/asmeurer","html_url":"https://github.com/asmeurer","followers_url":"https://api.github.com/users/asmeurer/followers","following_url":"https://api.github.com/users/asmeurer/following{/other_user}","gists_url":"https://api.github.com/users/asmeurer/gists{/gist_id}","starred_url":"https://api.github.com/users/asmeurer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/asmeurer/subscriptions","organizations_url":"https://api.github.com/users/asmeurer/orgs","repos_url":"https://api.github.com/users/asmeurer/repos","events_url":"https://api.github.com/users/asmeurer/events{/privacy}","received_events_url":"https://api.github.com/users/asmeurer/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":14,"created_at":"2015-05-27T22:35:08Z","updated_at":"2015-11-05T17:26:56Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/pyflakes/pyflakes/pulls/20","html_url":"https://github.com/pyflakes/pyflakes/pull/20","diff_url":"https://github.com/pyflakes/pyflakes/pull/20.diff","patch_url":"https://github.com/pyflakes/pyflakes/pull/20.patch"},"body":"This is the successor to https://github.com/pyflakes/pyflakes/pull/8.\r\n\r\nSo far, I have only extended https://github.com/pyflakes/pyflakes/pull/13 to check for return at a module scope. \r\n\r\nI have worked on checking for `break` and `continue` outside of loops, but it's tricky to get all the corner cases right. I'll need to double check what Python does with every type of ast node to make sure I don't miss anything. For instance, a naive \"bubble up until we see a loop\" is wrong, because the following are all syntax errors\r\n\r\n```py\r\nwhile True:\r\n    def f():\r\n        continue\r\n```\r\n\r\n```py\r\nwhile True:\r\n    pass\r\nelse:\r\n    continue\r\n```\r\n\r\n```py\r\nwhile True:\r\n    try:\r\n        pass\r\n    finally:\r\n        continue\r\n```\r\n\r\nThe compile.c code in CPython uses some different kind of ast object that already knows what kinds of valid blocks a node is in, so doesn't seem to be directly helpful in this case. \r\n\r\nI do plan to push more changes up here, though, including this one when I finish it. Feel free to merge early, however, if the work so far is fine (I may get stalled on this, so don't feel that you need to hold off until everything is finished). "},"comment":{"url":"https://api.github.com/repos/pyflakes/pyflakes/issues/comments/154130220","html_url":"https://github.com/pyflakes/pyflakes/pull/20#issuecomment-154130220","issue_url":"https://api.github.com/repos/pyflakes/pyflakes/issues/20","id":154130220,"user":{"login":"bitglue","id":1232472,"avatar_url":"https://avatars.githubusercontent.com/u/1232472?v=3","gravatar_id":"","url":"https://api.github.com/users/bitglue","html_url":"https://github.com/bitglue","followers_url":"https://api.github.com/users/bitglue/followers","following_url":"https://api.github.com/users/bitglue/following{/other_user}","gists_url":"https://api.github.com/users/bitglue/gists{/gist_id}","starred_url":"https://api.github.com/users/bitglue/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bitglue/subscriptions","organizations_url":"https://api.github.com/users/bitglue/orgs","repos_url":"https://api.github.com/users/bitglue/repos","events_url":"https://api.github.com/users/bitglue/events{/privacy}","received_events_url":"https://api.github.com/users/bitglue/received_events","type":"User","site_admin":false},"created_at":"2015-11-05T17:26:56Z","updated_at":"2015-11-05T17:26:56Z","body":"OK, that looks good. Would you mind squashing and rebasing? Then we are good to merge."}}