Skip to content

Commit fc701c4

Browse files
authored
Merge branch 'pylint-dev:main' into main
2 parents bb9d9d1 + c21276f commit fc701c4

21 files changed

+91
-53
lines changed

.github/workflows/changelog.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
$GITHUB_OUTPUT
4242
- name: Restore Python virtual environment
4343
id: cache-venv
44-
uses: actions/cache@v4.1.2
44+
uses: actions/cache@v4.2.0
4545
with:
4646
path: venv
4747
key: >-

.github/workflows/checks.yaml

+6-6
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949
$GITHUB_OUTPUT
5050
- name: Restore Python virtual environment
5151
id: cache-venv
52-
uses: actions/cache@v4.1.2
52+
uses: actions/cache@v4.2.0
5353
with:
5454
path: venv
5555
key: >-
@@ -71,7 +71,7 @@ jobs:
7171
hashFiles('.pre-commit-config.yaml') }}" >> $GITHUB_OUTPUT
7272
- name: Restore pre-commit environment
7373
id: cache-precommit
74-
uses: actions/cache@v4.1.2
74+
uses: actions/cache@v4.2.0
7575
with:
7676
path: ${{ env.PRE_COMMIT_CACHE }}
7777
key: >-
@@ -98,7 +98,7 @@ jobs:
9898
check-latest: true
9999
- name: Restore Python virtual environment
100100
id: cache-venv
101-
uses: actions/cache@v4.1.2
101+
uses: actions/cache@v4.2.0
102102
with:
103103
path: venv
104104
fail-on-cache-miss: true
@@ -107,7 +107,7 @@ jobs:
107107
needs.prepare-base.outputs.python-key }}
108108
- name: Restore pre-commit environment
109109
id: cache-precommit
110-
uses: actions/cache@v4.1.2
110+
uses: actions/cache@v4.2.0
111111
with:
112112
path: ${{ env.PRE_COMMIT_CACHE }}
113113
fail-on-cache-miss: true
@@ -139,7 +139,7 @@ jobs:
139139
check-latest: true
140140
- name: Restore Python virtual environment
141141
id: cache-venv
142-
uses: actions/cache@v4.1.2
142+
uses: actions/cache@v4.2.0
143143
with:
144144
path: venv
145145
fail-on-cache-miss: true
@@ -167,7 +167,7 @@ jobs:
167167
check-latest: true
168168
- name: Restore Python virtual environment
169169
id: cache-venv
170-
uses: actions/cache@v4.1.2
170+
uses: actions/cache@v4.2.0
171171
with:
172172
path: venv
173173
fail-on-cache-miss: true

.github/workflows/primer-test.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ jobs:
5151
$GITHUB_OUTPUT
5252
- name: Restore Python virtual environment
5353
id: cache-venv
54-
uses: actions/cache@v4.1.2
54+
uses: actions/cache@v4.2.0
5555
with:
5656
path: venv
5757
key: >-
@@ -84,7 +84,7 @@ jobs:
8484
check-latest: true
8585
- name: Restore Python virtual environment
8686
id: cache-venv
87-
uses: actions/cache@v4.1.2
87+
uses: actions/cache@v4.2.0
8888
with:
8989
path: venv
9090
fail-on-cache-miss: true

.github/workflows/primer_comment.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
# Restore cached Python environment
4242
- name: Restore Python virtual environment
4343
id: cache-venv
44-
uses: actions/cache@v4.1.2
44+
uses: actions/cache@v4.2.0
4545
with:
4646
path: venv
4747
key:

.github/workflows/primer_run_main.yaml

+6-6
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ jobs:
4545
# Create a re-usable virtual environment
4646
- name: Restore Python virtual environment cache
4747
id: cache-venv
48-
uses: actions/cache/restore@v4.1.2
48+
uses: actions/cache/restore@v4.2.0
4949
with:
5050
path: venv
5151
key:
@@ -63,7 +63,7 @@ jobs:
6363
# Save cached Python environment (explicit because cancel-in-progress: true)
6464
- name: Save Python virtual environment to cache
6565
if: steps.cache-venv.outputs.cache-hit != 'true'
66-
uses: actions/cache/save@v4.1.2
66+
uses: actions/cache/save@v4.2.0
6767
with:
6868
path: venv
6969
key:
@@ -82,7 +82,7 @@ jobs:
8282
echo "commitstring=$output" >> $GITHUB_OUTPUT
8383
- name: Restore projects cache
8484
id: cache-projects
85-
uses: actions/cache/restore@v4.1.2
85+
uses: actions/cache/restore@v4.2.0
8686
with:
8787
path: tests/.pylint_primer_tests/
8888
key: >-
@@ -95,14 +95,14 @@ jobs:
9595
python tests/primer/__main__.py prepare --clone
9696
- name: Save projects cache
9797
if: steps.cache-projects.outputs.cache-hit != 'true'
98-
uses: actions/cache/save@v4.1.2
98+
uses: actions/cache/save@v4.2.0
9999
with:
100100
path: tests/.pylint_primer_tests/
101101
key: >-
102102
${{ runner.os }}-${{ matrix.python-version }}-${{
103103
steps.commitstring.outputs.commitstring }}-primer
104104
- name: Upload commit string
105-
uses: actions/upload-artifact@v4.4.3
105+
uses: actions/upload-artifact@v4.5.0
106106
if: matrix.batchIdx == 0
107107
with:
108108
name: primer_commitstring_${{ matrix.python-version }}
@@ -123,7 +123,7 @@ jobs:
123123
then echo "::warning ::$WARNINGS"
124124
fi
125125
- name: Upload output
126-
uses: actions/upload-artifact@v4.4.3
126+
uses: actions/upload-artifact@v4.5.0
127127
with:
128128
name:
129129
primer_output_main_${{ matrix.python-version }}_batch${{ matrix.batchIdx }}

.github/workflows/primer_run_pr.yaml

+7-7
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ jobs:
5656
# Restore cached Python environment
5757
- name: Restore Python virtual environment
5858
id: cache-venv
59-
uses: actions/cache/restore@v4.1.2
59+
uses: actions/cache/restore@v4.2.0
6060
with:
6161
path: venv
6262
key:
@@ -75,7 +75,7 @@ jobs:
7575
# Save cached Python environment (explicit because cancel-in-progress: true)
7676
- name: Save Python virtual environment
7777
if: steps.cache-venv.outputs.cache-hit != 'true'
78-
uses: actions/cache/save@v4.1.2
78+
uses: actions/cache/save@v4.2.0
7979
with:
8080
path: venv
8181
key:
@@ -151,7 +151,7 @@ jobs:
151151
echo "commitstring=$output" >> $GITHUB_OUTPUT
152152
- name: Restore projects cache
153153
id: cache-projects
154-
uses: actions/cache/restore@v4.1.2
154+
uses: actions/cache/restore@v4.2.0
155155
with:
156156
path: tests/.pylint_primer_tests/
157157
key: >-
@@ -164,7 +164,7 @@ jobs:
164164
python tests/primer/__main__.py prepare --clone
165165
- name: Save projects cache
166166
if: steps.cache-projects.outputs.cache-hit != 'true'
167-
uses: actions/cache/save@v4.1.2
167+
uses: actions/cache/save@v4.2.0
168168
with:
169169
path: tests/.pylint_primer_tests/
170170
key: >-
@@ -197,15 +197,15 @@ jobs:
197197
then echo "::warning ::$WARNINGS"
198198
fi
199199
- name: Upload output of PR
200-
uses: actions/upload-artifact@v4.4.3
200+
uses: actions/upload-artifact@v4.5.0
201201
with:
202202
name:
203203
primer_output_pr_${{ matrix.python-version }}_batch${{ matrix.batchIdx }}
204204
path:
205205
tests/.pylint_primer_tests/output_${{ matrix.python-version }}_pr_batch${{
206206
matrix.batchIdx }}.txt
207207
- name: Upload output of 'main'
208-
uses: actions/upload-artifact@v4.4.3
208+
uses: actions/upload-artifact@v4.5.0
209209
with:
210210
name:
211211
primer_output_main_${{ matrix.python-version }}_batch${{ matrix.batchIdx }}
@@ -218,7 +218,7 @@ jobs:
218218
- name: Upload PR number
219219
if:
220220
startsWith(steps.python.outputs.python-version, '3.9') && matrix.batchIdx == 0
221-
uses: actions/upload-artifact@v4.4.3
221+
uses: actions/upload-artifact@v4.5.0
222222
with:
223223
name: pr_number
224224
path: pr_number.txt

.github/workflows/tests.yaml

+8-8
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ jobs:
5252
$GITHUB_OUTPUT
5353
- name: Restore Python virtual environment
5454
id: cache-venv
55-
uses: actions/cache@v4.1.2
55+
uses: actions/cache@v4.2.0
5656
with:
5757
path: venv
5858
key: >-
@@ -76,7 +76,7 @@ jobs:
7676
pip list | grep 'astroid\|pylint'
7777
python -m pytest -vv --minimal-messages-config tests/test_functional.py
7878
- name: Upload coverage artifact
79-
uses: actions/upload-artifact@v4.4.3
79+
uses: actions/upload-artifact@v4.5.0
8080
with:
8181
name: coverage-${{ matrix.python-version }}
8282
include-hidden-files: true
@@ -98,7 +98,7 @@ jobs:
9898
check-latest: true
9999
- name: Restore Python virtual environment
100100
id: cache-venv
101-
uses: actions/cache@v4.1.2
101+
uses: actions/cache@v4.2.0
102102
with:
103103
path: venv
104104
fail-on-cache-miss: true
@@ -138,7 +138,7 @@ jobs:
138138
check-latest: true
139139
- name: Restore Python virtual environment
140140
id: cache-venv
141-
uses: actions/cache@v4.1.2
141+
uses: actions/cache@v4.2.0
142142
with:
143143
path: venv
144144
fail-on-cache-miss: true
@@ -161,7 +161,7 @@ jobs:
161161
run: >-
162162
echo "datetime="$(date "+%Y%m%d_%H%M") >> $GITHUB_OUTPUT
163163
- name: Upload benchmark artifact
164-
uses: actions/upload-artifact@v4.4.3
164+
uses: actions/upload-artifact@v4.5.0
165165
with:
166166
name:
167167
benchmark-${{ runner.os }}-${{ matrix.python-version }}_${{
@@ -199,7 +199,7 @@ jobs:
199199
}}" >> $env:GITHUB_OUTPUT
200200
- name: Restore Python virtual environment
201201
id: cache-venv
202-
uses: actions/cache@v4.1.2
202+
uses: actions/cache@v4.2.0
203203
with:
204204
path: venv
205205
key: >-
@@ -245,7 +245,7 @@ jobs:
245245
}}" >> $GITHUB_OUTPUT
246246
- name: Restore Python virtual environment
247247
id: cache-venv
248-
uses: actions/cache@v4.1.2
248+
uses: actions/cache@v4.2.0
249249
with:
250250
path: venv
251251
key: >-
@@ -289,7 +289,7 @@ jobs:
289289
}}" >> $GITHUB_OUTPUT
290290
- name: Restore Python virtual environment
291291
id: cache-venv
292-
uses: actions/cache@v4.1.2
292+
uses: actions/cache@v4.2.0
293293
with:
294294
path: venv
295295
key: >-

.pre-commit-config.yaml

+4-4
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ repos:
2020
doc/data/messages/m/missing-final-newline/bad/crlf.py
2121
)$
2222
- repo: https://github.com/astral-sh/ruff-pre-commit
23-
rev: "v0.8.1"
23+
rev: "v0.8.4"
2424
hooks:
2525
- id: ruff
2626
args: ["--fix"]
@@ -125,7 +125,7 @@ repos:
125125
files: ^(doc/(.*/)*.*\.rst)
126126
additional_dependencies: [Sphinx==7.4.3]
127127
- repo: https://github.com/pre-commit/mirrors-mypy
128-
rev: v1.13.0
128+
rev: v1.14.0
129129
hooks:
130130
- id: mypy
131131
name: mypy
@@ -140,11 +140,11 @@ repos:
140140
"platformdirs==2.2.0",
141141
"py==1.11",
142142
"tomlkit>=0.10.1",
143-
"types-pkg_resources==0.1.3",
143+
"types-setuptools==75.6.0.20241126",
144144
]
145145
exclude: tests(/\w*)*/functional/|tests/input|tests(/.*)+/conftest.py|doc/data/messages|tests(/\w*)*data/
146146
- repo: https://github.com/rbubley/mirrors-prettier
147-
rev: v3.4.1
147+
rev: v3.4.2
148148
hooks:
149149
- id: prettier
150150
args: [--prose-wrap=always, --print-width=88]

doc/development_guide/contributor_guide/tests/launching_test.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ tox
3030
You can also *optionally* install tox_ and run our tests using the tox_ package, as in::
3131

3232
python -m tox
33-
python -m tox -epy312 # for Python 3.12 suite only
33+
python -m tox -epy313 # for Python 3.13 suite only
3434
python -m tox -epylint # for running Pylint over Pylint's codebase
3535
python -m tox -eformatting # for running formatting checks over Pylint's codebase
3636

doc/whatsnew/3/3.3/index.rst

+29
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,35 @@ Summary -- Release highlights
1414

1515
.. towncrier release notes start
1616
17+
What's new in Pylint 3.3.3?
18+
---------------------------
19+
Release date: 2024-12-23
20+
21+
22+
False Positives Fixed
23+
---------------------
24+
25+
- Fix false positives for ``undefined-variable`` for classes using Python 3.12
26+
generic type syntax.
27+
28+
Closes #9335 (`#9335 <https://github.com/pylint-dev/pylint/issues/9335>`_)
29+
30+
- Fix a false positive for `use-implicit-booleaness-not-len`. No lint should be emitted for
31+
generators (`len` is not defined for generators).
32+
33+
Refs #10100 (`#10100 <https://github.com/pylint-dev/pylint/issues/10100>`_)
34+
35+
36+
37+
Other Bug Fixes
38+
---------------
39+
40+
- Fix ``Unable to import 'collections.abc' (import-error)`` on Python 3.13.1.
41+
42+
Closes #10112 (`#10112 <https://github.com/pylint-dev/pylint/issues/10112>`_)
43+
44+
45+
1746
What's new in Pylint 3.3.2?
1847
---------------------------
1948
Release date: 2024-12-01

doc/whatsnew/fragments/10100.false_positive

-4
This file was deleted.

pylint/checkers/variables.py

+15-1
Original file line numberDiff line numberDiff line change
@@ -1742,6 +1742,11 @@ def _should_node_be_skipped(
17421742
if utils.is_ancestor_name(consumer.node, node) or (
17431743
not is_start_index and self._ignore_class_scope(node)
17441744
):
1745+
if any(
1746+
node.name == param.name.name for param in consumer.node.type_params
1747+
):
1748+
return False
1749+
17451750
return True
17461751

17471752
# Ignore inner class scope for keywords in class definition
@@ -1952,7 +1957,9 @@ def _check_consumer(
19521957
)
19531958
return (VariableVisitConsumerAction.RETURN, found_nodes)
19541959

1955-
elif isinstance(defstmt, nodes.ClassDef):
1960+
elif (
1961+
isinstance(defstmt, nodes.ClassDef) and defnode not in defframe.type_params
1962+
):
19561963
return self._is_first_level_self_reference(node, defstmt, found_nodes)
19571964

19581965
elif isinstance(defnode, nodes.NamedExpr):
@@ -2334,6 +2341,13 @@ def _is_variable_violation(
23342341
maybe_before_assign = defnode.value is node or any(
23352342
anc is defnode.value for anc in node.node_ancestors()
23362343
)
2344+
elif (
2345+
isinstance(defframe, nodes.ClassDef)
2346+
and defnode in defframe.type_params
2347+
):
2348+
# Generic on parent class:
2349+
# class Child[_T](Parent[_T])
2350+
maybe_before_assign = False
23372351

23382352
return maybe_before_assign, annotation_return, use_outer_definition
23392353

0 commit comments

Comments
 (0)