-
Notifications
You must be signed in to change notification settings - Fork 180
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
maximum recursion depth exceeded in 1050 string join #231
Comments
Original comment by icordasc (@sigmavirus24?) on Launchpad: So I looked into this a little. As you can (maybe) tell by the stack trace what happens is we get stuck in a recursion loop between handleChildren and handleNode. Why? So the first thing we see is the Assign statement, and the value of the assign is a BinOp which consists of a left with another BinOp and a right with a string. You might have an idea where this is going. That BinOp then has a BinOp on the left side and a String on the right. Etc. etc. etc. I don't know how many things like this we'll see in the real world, so my inclination is to maybe figure out what operations we might want to try to flatten before recursing through them if that makes any sense. We could potentially flatten this like so:
But I have a hunch that'll be slow to do and could end up being impractical for anything other than some what special cases like this one. (I'm also operating on low coffee so it could just be I'm missing an obvious solution.) |
Original comment by jayvdb (@jayvdb?) on Launchpad: WIP patch up at #70 A more simplistic approach, suitable for merging promptly, is #68 |
Original comment by jayvdb (@jayvdb?) on Launchpad: I ran into this bug on https://pypi.python.org/pypi/idna recently released v2.1, file https://github.com/kjd/idna/blob/master/idna/idnadata.py This is ranked 119th most popular package : http://pypi-ranking.info/module/idna Both patches fix this bug for idna as well as astroid's test data. |
can we have a command line flag or config to set the recursion limit? edition the source code is really annoying. |
I am also facing this issue in some of my projects. |
I suspect to actually fix this a full rewrite of pyflakes is necessary. the current structure depends on recursion to do a tree traversal. jayvdb's patch improves this but does not eliminate the recursion (so while it may fix some cases, it does not solve all of them) |
I see @asottile - thanks for the reply. But if there is something to reduce the chance of finding this error - would you be open to getting that merged ? Or are you thinking we should just find a complete fix to the solution ? |
Original report by jayvdb (@jayvdb?) on Launchpad:
Running current pyflakes on astroid results in maximum recursion depth exceeded on a test module.
https://bitbucket.org/logilab/astroid/src/6d4e198bdc7091f36c2c24d911c5ee92b64847c2/astroid/tests/testdata/python2/data/joined_strings.py
Setting sys.setrecursionlimit(2500) fixes the problem
The text was updated successfully, but these errors were encountered: