Skip to content

Add compatibility with astroid inference cache changes #8872

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

Merged
merged 14 commits into from
Aug 5, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ sphinx-reredirects<1
towncrier~=23.6
furo==2023.5.20
-e .
astroid @ git+https://github.com/pylint-dev/pylint.git@cf8763a2b8e897ec7c8389906f3cb13714300cd2
13 changes: 5 additions & 8 deletions pylint/checkers/typecheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -1899,16 +1899,13 @@ def visit_with(self, node: nodes.With) -> None:

# Retrieve node from all previously visited nodes in the
# inference history
context_path_names: Iterator[Any] = filter(
None, _unflatten(context.path)
)
inferred_paths = _flatten_container(
safe_infer(path) for path in context_path_names
)
for inferred_path in inferred_paths:
for inferred_path, _ in context.path:
if not inferred_path:
continue
scope = inferred_path.scope()
if isinstance(inferred_path, nodes.Call):
scope = safe_infer(inferred_path.func)
else:
scope = inferred_path.scope()
if not isinstance(scope, nodes.FunctionDef):
continue
if decorated_with(
Expand Down
2 changes: 1 addition & 1 deletion pylint/checkers/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1471,7 +1471,7 @@ def node_type(node: nodes.NodeNG) -> SuccessfulInferenceResult | None:
# don't handle it for now
types: set[SuccessfulInferenceResult] = set()
try:
for var_type in node.infer():
for var_type in node.infer(context=InferenceContext()):
if isinstance(var_type, util.UninferableBase) or is_none(var_type):
continue
types.add(var_type)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ dependencies = [
# Also upgrade requirements_test_min.txt.
# Pinned to dev of second minor update to allow editable installs and fix primer issues,
# see https://github.com/pylint-dev/astroid/issues/1341
"astroid>=3.0.0a8,<=3.1.0-dev0",
"astroid @ git+https://github.com/pylint-dev/pylint.git@cf8763a2b8e897ec7c8389906f3cb13714300cd2",
"isort>=4.2.5,<6",
"mccabe>=0.6,<0.8",
"tomli>=1.1.0;python_version<'3.11'",
Expand Down
2 changes: 1 addition & 1 deletion requirements_test_min.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
-e .[testutils,spelling]
# astroid dependency is also defined in pyproject.toml
astroid==3.0.0a8 # Pinned to a specific version for tests
astroid @ git+https://github.com/pylint-dev/pylint.git@cf8763a2b8e897ec7c8389906f3cb13714300cd2
typing-extensions~=4.7
py~=1.11.0
pytest~=7.4
Expand Down