Commit bdd017f
[Backport maintenance/4.0.x] Fix
Fix `too-many-locals` counting PEP 695 type parameters as local variables (#11138)
Fix too-many-locals counting PEP 695 type parameters as locals
astroid places PEP 695 type-param names in node.locals, so R0914 over-counted (def f[T1..T16](x) reported 17/15 for one real local). Exclude type params from the count. Closes #11136
(cherry picked from commit e628929)
Co-authored-by: Hibi <hibin.m@gmail.com>
Co-authored-by: Synvoya <16019863+Synvoya@users.noreply.github.com>too-many-locals counting PEP 695 type parameters as local variables (#11142)1 parent 5153a7c commit bdd017f
5 files changed
Lines changed: 41 additions & 1 deletion
File tree
- doc/whatsnew/fragments
- pylint/checkers
- tests/functional/t/too
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
577 | 577 | | |
578 | 578 | | |
579 | 579 | | |
580 | | - | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
581 | 584 | | |
582 | 585 | | |
583 | 586 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
0 commit comments