-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
sys.argv
is inferred wrongly as pylint's own values for sys.argv
instead of Uninferrable
#7710
Comments
|
This can still be a |
Maybe astroid needs to raise an inference error on sys.argv. That would be more accurate and also probably fix pylint in this particular case because if we can't infer we don't raise to avoid false positives. |
I think it definitely makes sense to not report an error here. The workaround to quell the error is replacing Maybe related: my first attempt to solve this was: |
sys.argv
is inferred wrongly as pylint's own values for sys.argv
instead of Uninferrable
This require a change in astroid to infer correctly sys.argv as uninferrable. Using |
Yup, agreed. That aligns with my use case: if I was writing a tool that needed to do parsing of user arguments I'd use argparse or optparse because stdlib, but in this case I actually want to generate a script at runtime and then execute it with a different python interpreter than the current one. It's not user facing, I always know exactly how many arguments are internally passed, so I feel confident in not bothering with even checking the length, let alone using named flag-arguments. |
This was a very frustrating to debug. Adding an extra Python file to my project caused this error in a completely different Python file that previously was fine. I would disable it by default until this is fixed. |
It's impossible to infer the value it will have outside of static analysis where it's our own value. See pylint-dev/pylint#7710
It's impossible to infer the value it will have outside of static analysis where it's our own value. See pylint-dev/pylint#7710
This line bugs out once in a while in pylint ever since we enabled parallelism. Since the parallel gains are substantial, let's just disable the check there. See pylint-dev/pylint#7710
This line bugs out once in a while in pylint ever since we enabled parallelism. Since the parallel gains are substantial, let's just disable the check there. See pylint-dev/pylint#7710
It's impossible to infer the value it will have outside of static analysis where it's our own value. See pylint-dev/pylint#7710
It's impossible to infer the value it will have outside of static analysis where it's our own value. See pylint-dev/pylint#7710 (cherry picked from commit ea78827)
…never is (#2244) (#2297) * Make `sys.argv` uninferable because it never is (#2244) It's impossible to infer the value it will have outside of static analysis where it's our own value. See pylint-dev/pylint#7710 (cherry picked from commit ea78827) Co-authored-by: Pierre Sassoulas <[email protected]>
Bug description
Make file
t.py
and run
python t.py 1 2
Configuration
No response
Command used
Pylint output
$ pylint t.py ************* Module t t.py:1:0: C0114: Missing module docstring (missing-module-docstring) t.py:3:0: W0632: Possible unbalanced tuple unpacking with sequence: left side has 3 label(s), right side has 2 value(s) (unbalanced-tuple-unpacking) ------------------------------------------------------------------ Your code has been rated at 3.33/10 (previous run: 0.00/10, +3.33)
Expected behavior
The W0632 on line 3 looks like a bug, as in this case
sys.argv
is['t.py', '1', '2']
Pylint version
OS / Environment
Additional dependencies
No response
The text was updated successfully, but these errors were encountered: