-
-
Notifications
You must be signed in to change notification settings - Fork 293
Cannot infer assignment with operator for a simple list of strings #1398
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
Comments
Sorry this might be false manipulation, I've added these tests to tests/unittest_inference.py and they failed, but running them manually in the python interactive interpreter, it works as expected. So I'm confused. |
If you open a PR adding those tests we'll be able to see if they pass for all interpreters or only some of them :) |
Ok! |
So yes it fails @Pierre-Sassoulas, do you have an idea where to look for the issue? Thanks |
It's so weird because the follwing works: >>> from astroid import parse
>>> mod1 = parse(("from top.mod import __dunder_var__ as v\n"
... "__dunder_var__ = ['w'] + v"),
... module_name='top')
>>> mod2 = parse("__dunder_var__ = ['v']", module_name='top.mod')
>>> list(mod1.body[-1].value.infer())[0].as_string()
"['w', 'v']" But in the pytest env it doesn't :/ |
Could it be because |
No, top.mod is only defined because I passed module_name=“top.mod” to the parse() function. And it should work right ? |
Ok, sorry that was indeed a false manipulation, the fake module Adding |
Uh oh!
There was an error while loading. Please reload this page.
Steps to reproduce
Current behavior
It seems that operators are fully supported for lists of ints but not for list of strings, I'm unsure why, it seems the same level of complexity. Also it's very weird that it gives the
Uninferable
result for dunder variables.Expected behavior
All tests should pass IMO.
Astroid version 2.9.3
The text was updated successfully, but these errors were encountered: