Skip to content

Commit f499686

Browse files
Update astroid version to 3.1.0 (#9457)
* Update astroid version to 3.1.0 * Fix SyntaxError test outputs * Fix self tests * Prevent `invalid-name` for PEP 695 nodes Co-authored-by: Jacob Walls <[email protected]>
1 parent d4f0ef7 commit f499686

34 files changed

+38
-9
lines changed

doc/whatsnew/fragments/9196.feature

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Check ``TypeAlias`` and ``TypeVar`` (PEP 695) nodes for ``invalid-name``.
2+
3+
Refs #9196

doc/whatsnew/fragments/9457.internal

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Update astroid version to 3.1.0.
2+
3+
Refs #9457

pylint/checkers/base/name_checker/checker.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,12 @@ def visit_assignname( # pylint: disable=too-many-branches
409409
if isinstance(assign_type, nodes.Comprehension):
410410
self._check_name("inlinevar", node.name, node)
411411

412+
elif isinstance(assign_type, nodes.TypeVar):
413+
self._check_name("typevar", node.name, node)
414+
415+
elif isinstance(assign_type, nodes.TypeAlias):
416+
self._check_name("typealias", node.name, node)
417+
412418
# Check names defined in module scope
413419
elif isinstance(frame, nodes.Module):
414420
# Check names defined in Assign nodes
@@ -625,6 +631,9 @@ def _check_typevar(self, name: str, node: nodes.AssignName) -> None:
625631
node.assign_type().value.elts[node.parent.elts.index(node)].keywords
626632
)
627633
args = node.assign_type().value.elts[node.parent.elts.index(node)].args
634+
else: # PEP 695 generic type nodes
635+
keywords = ()
636+
args = ()
628637

629638
variance = TypeVarVariance.invariant
630639
name_arg = None

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ dependencies = [
4141
# Also upgrade requirements_test_min.txt.
4242
# Pinned to dev of second minor update to allow editable installs and fix primer issues,
4343
# see https://github.com/pylint-dev/astroid/issues/1341
44-
"astroid>=3.0.3,<=3.1.0-dev0",
44+
"astroid>=3.1.0,<=3.2.0-dev0",
4545
"isort>=4.2.5,<6,!=5.13.0",
4646
"mccabe>=0.6,<0.8",
4747
"tomli>=1.1.0;python_version<'3.11'",

requirements_test_min.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
.[testutils,spelling]
22
# astroid dependency is also defined in pyproject.toml
3-
astroid==3.0.3 # Pinned to a specific version for tests
3+
astroid==3.1.0 # Pinned to a specific version for tests
44
typing-extensions~=4.9
55
py~=1.11.0
66
pytest~=7.4

tests/functional/i/import_error.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import-error:3:0:3:22::Unable to import 'totally_missing':UNDEFINED
22
import-error:21:4:21:26::Unable to import 'maybe_missing_2':UNDEFINED
33
no-name-in-module:33:0:33:49::No name 'syntax_error' in module 'functional.s.syntax':UNDEFINED
4-
syntax-error:33:0:None:None::Cannot import 'functional.s.syntax.syntax_error' due to 'invalid syntax (<unknown>, line 1)':HIGH
4+
syntax-error:33:0:None:None::Cannot import 'functional.s.syntax.syntax_error' due to 'invalid syntax (functional.s.syntax.syntax_error, line 1)':HIGH
55
multiple-imports:78:0:78:15::Multiple imports on one line (foo, bar):UNDEFINED
66
import-error:96:4:96:15::Unable to import 'foo2':UNDEFINED
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
syntax-error:1:5:None:None::"Parsing failed: 'invalid syntax (<unknown>, line 1)'":HIGH
1+
syntax-error:1:5:None:None::"Parsing failed: 'invalid syntax (syntax_error, line 1)'":HIGH

tests/functional/t/type/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)