Skip to content
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

astroid 2.0.0 chokes on recursion #557

Closed
hroncok opened this issue Jun 8, 2018 · 1 comment
Closed

astroid 2.0.0 chokes on recursion #557

hroncok opened this issue Jun 8, 2018 · 1 comment

Comments

@hroncok
Copy link
Contributor

hroncok commented Jun 8, 2018

Steps to reproduce

https://github.com/PyCQA/astroid/blob/master/astroid/tests/testdata/python3/data/joined_strings.py

import astroid
import pathlib
astroid.MANAGER.optimize_ast = True
source = pathlib.Path('joined_strings.py').read_text()
builder = astroid.builder.AstroidBuilder()
tree = builder.string_build(source)

Current behavior with 1.6

No exception.

Current behavior with 2.0

RecursionError: maximum recursion depth exceeded

This breaks asttokens tests: gristlabs/asttokens#16

@PCManticore
Copy link
Contributor

I think this is fine. In the past we used to have a hack for supporting joining thousands of strings together, but we decided to remove that hack with this release. There's no need to support such an use case as it's not going to happen in real life, and if it does, then there's no expectation for astroid to work on that IMO. What asttokens might be doing is running astroid over the data test files from astroid, as I can see from their repo, but I suggest that they should remove the joined_strings file as it's no longer a supported use case. Here's the removal of that hack for reference 5176976.

keszybz added a commit to keszybz/asttokens that referenced this issue Jul 5, 2018
From pylint-dev/astroid#557 (comment):
> In the past we used to have a hack for supporting joining thousands
> of strings together, but we decided to remove that hack with this
> release. There's no need to support such an use case as it's not
> going to happen in real life, and if it does, then there's no
> expectation for astroid to work on that IMO. What asttokens might be
> doing is running astroid over the data test files from astroid, as I
> can see from their repo, but I suggest that they should remove the
> joined_strings file as it's no longer a supported use case. Here's
> the removal of that hack for reference [1]
[1] pylint-dev/astroid@5176976

So let's just remove the test.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants