Skip to content

Commit 3974ec1

Browse files
Merge remote-tracking branch 'origin/main' into nedelcu-ioan-main
2 parents ac6e517 + 1812899 commit 3974ec1

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

doc/whatsnew/fragments/10105.bugfix

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Fixed a crash when importing a class decorator that did not exist with the same name than a class attribute after the class definition.
2+
3+
Closes #10105

pylint/checkers/variables.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2445,7 +2445,7 @@ def _is_only_type_assignment(
24452445
node_frame = node.frame()
24462446

24472447
parent = node
2448-
while parent is not defstmt_frame.parent:
2448+
while parent not in {defstmt_frame.parent, None}:
24492449
parent_scope = parent.scope()
24502450

24512451
# Find out if any nonlocals receive values in nested functions
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# pylint: disable=too-few-public-methods,missing-docstring,used-before-assignment,import-error,unused-import
2+
# pylint: disable=wrong-import-position
3+
4+
5+
@decorator
6+
class DecoratedClass:
7+
decorator: int
8+
9+
import decorator

0 commit comments

Comments
 (0)