Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 835b427

Browse filesBrowse files
authored
Revert "Check __setattr__ when property is not settable (#9196)" (#9474)
This reverts commit 3186281. Co-authored-by: hauntsaninja <>
1 parent fac2cda commit 835b427
Copy full SHA for 835b427

File tree

Expand file treeCollapse file tree

3 files changed

+2
-44
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+2
-44
lines changed

‎mypy/checkmember.py

Copy file name to clipboardExpand all lines: mypy/checkmember.py
+2-4Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -553,8 +553,7 @@ def analyze_var(name: str,
553553
return mx.chk.handle_partial_var_type(typ, mx.is_lvalue, var, mx.context)
554554
if mx.is_lvalue and var.is_property and not var.is_settable_property:
555555
# TODO allow setting attributes in subclass (although it is probably an error)
556-
if info.get('__setattr__') is None:
557-
mx.msg.read_only_property(name, itype.type, mx.context)
556+
mx.msg.read_only_property(name, itype.type, mx.context)
558557
if mx.is_lvalue and var.is_classvar:
559558
mx.msg.cant_assign_to_classvar(name, mx.context)
560559
t = get_proper_type(expand_type_by_instance(typ, itype))
@@ -564,8 +563,7 @@ def analyze_var(name: str,
564563
if mx.is_lvalue:
565564
if var.is_property:
566565
if not var.is_settable_property:
567-
if info.get('__setattr__') is None:
568-
mx.msg.read_only_property(name, itype.type, mx.context)
566+
mx.msg.read_only_property(name, itype.type, mx.context)
569567
else:
570568
mx.msg.cant_assign_to_method(mx.context)
571569

‎mypy/test/testcheck.py

Copy file name to clipboardExpand all lines: mypy/test/testcheck.py
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@
9090
'check-reports.test',
9191
'check-errorcodes.test',
9292
'check-annotated.test',
93-
'check-setattr.test',
9493
'check-parameter-specification.test',
9594
]
9695

‎test-data/unit/check-setattr.test

Copy file name to clipboardExpand all lines: test-data/unit/check-setattr.test
-39Lines changed: 0 additions & 39 deletions
This file was deleted.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.