Skip to content

Commit

Permalink
[sys.argv] Make 'sys.argv' uninferable because it never is
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Pierre-Sassoulas committed Jul 8, 2023
1 parent 3334919 commit 6a293bc
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/test_inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -7205,3 +7205,18 @@ def test_old_style_string_formatting_with_specs(self) -> None:
inferred = next(node.infer())
assert isinstance(inferred, nodes.Const)
assert inferred.value == "My name is Daniel, I'm 12.00"


def test_sys_argv_uninferable() -> None:
"""Regression test for https://github.com/pylint-dev/pylint/issues/7710."""
a: nodes.List = extract_node(
textwrap.dedent(
"""
import sys
sys.argv"""
)
)
sys_argv_value = list(a._infer())
assert len(sys_argv_value) == 1
assert sys_argv_value[0] is Uninferable

0 comments on commit 6a293bc

Please sign in to comment.