{"action":"created","issue":{"url":"https://api.github.com/repos/pyflakes/pyflakes/issues/68","repository_url":"https://api.github.com/repos/pyflakes/pyflakes","labels_url":"https://api.github.com/repos/pyflakes/pyflakes/issues/68/labels{/name}","comments_url":"https://api.github.com/repos/pyflakes/pyflakes/issues/68/comments","events_url":"https://api.github.com/repos/pyflakes/pyflakes/issues/68/events","html_url":"https://github.com/pyflakes/pyflakes/pull/68","id":153482936,"number":68,"title":"Manage recursion limit preventing RuntimeError","user":{"login":"jayvdb","id":15092,"avatar_url":"https://avatars.githubusercontent.com/u/15092?v=3","gravatar_id":"","url":"https://api.github.com/users/jayvdb","html_url":"https://github.com/jayvdb","followers_url":"https://api.github.com/users/jayvdb/followers","following_url":"https://api.github.com/users/jayvdb/following{/other_user}","gists_url":"https://api.github.com/users/jayvdb/gists{/gist_id}","starred_url":"https://api.github.com/users/jayvdb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jayvdb/subscriptions","organizations_url":"https://api.github.com/users/jayvdb/orgs","repos_url":"https://api.github.com/users/jayvdb/repos","events_url":"https://api.github.com/users/jayvdb/events{/privacy}","received_events_url":"https://api.github.com/users/jayvdb/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-05-06T15:57:12Z","updated_at":"2016-05-06T16:07:42Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/pyflakes/pyflakes/pulls/68","html_url":"https://github.com/pyflakes/pyflakes/pull/68","diff_url":"https://github.com/pyflakes/pyflakes/pull/68.diff","patch_url":"https://github.com/pyflakes/pyflakes/pull/68.patch"},"body":"pyflakes has traditionally recursed with a handler for every\r\nlevel of the ast.  The ast depth can become very large, especially\r\nfor an expression containing many binary operators.\r\n\r\nPython has a maximum recursion limit, defaulting to a low number\r\nlike 1000, which resulted in a RuntimeError for the ast of:\r\n\r\n    x = 1 + 2 + 3 + ... + 1001\r\n\r\nTo workaround this problem, pyflakes now increases the recursion\r\nlimit at runtime when it knows it will be exceeded.\r\n\r\nFixes lp:1507827"},"comment":{"url":"https://api.github.com/repos/pyflakes/pyflakes/issues/comments/217485927","html_url":"https://github.com/pyflakes/pyflakes/pull/68#issuecomment-217485927","issue_url":"https://api.github.com/repos/pyflakes/pyflakes/issues/68","id":217485927,"user":{"login":"jayvdb","id":15092,"avatar_url":"https://avatars.githubusercontent.com/u/15092?v=3","gravatar_id":"","url":"https://api.github.com/users/jayvdb","html_url":"https://github.com/jayvdb","followers_url":"https://api.github.com/users/jayvdb/followers","following_url":"https://api.github.com/users/jayvdb/following{/other_user}","gists_url":"https://api.github.com/users/jayvdb/gists{/gist_id}","starred_url":"https://api.github.com/users/jayvdb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jayvdb/subscriptions","organizations_url":"https://api.github.com/users/jayvdb/orgs","repos_url":"https://api.github.com/users/jayvdb/repos","events_url":"https://api.github.com/users/jayvdb/events{/privacy}","received_events_url":"https://api.github.com/users/jayvdb/received_events","type":"User","site_admin":false},"created_at":"2016-05-06T16:07:42Z","updated_at":"2016-05-06T16:07:42Z","body":"I've gone for the simple workaround for https://bugs.launchpad.net/pyflakes/+bug/1507827 , as this is the only Exception I can find, and the alternative (flattening) is a complex patch not suitable for a patch or even minor release.\r\n\r\nI'd really like this solved, as it means I can run `pyflakes .` in a parent directory above all of my python packages as a form of regression testing, but that fails currently due to this exception.\r\n\r\nI have one more minor bug in my flatten patch, but should have it up in a few hours.  It is easy enough to verify for unary/boolean/binary ops only, but the bug would still exist elsewhere.  Solving it for boolean/binary op is not easy, as boolean/binary ops can contain lambda's, and pyflakes has deferred processing of lambdas.  I've fixed that problem - my issue is now just generators on py2.7 only.  What I do know is the fix is going to need a lot of vetting & testing before it is released."}}