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

Revert "Check __setattr__ when property is not settable (#9196)" #9474

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions 6 mypy/checkmember.py
Original file line number Diff line number Diff line change
Expand Up @@ -553,8 +553,7 @@ def analyze_var(name: str,
return mx.chk.handle_partial_var_type(typ, mx.is_lvalue, var, mx.context)
if mx.is_lvalue and var.is_property and not var.is_settable_property:
# TODO allow setting attributes in subclass (although it is probably an error)
if info.get('__setattr__') is None:
mx.msg.read_only_property(name, itype.type, mx.context)
mx.msg.read_only_property(name, itype.type, mx.context)
if mx.is_lvalue and var.is_classvar:
mx.msg.cant_assign_to_classvar(name, mx.context)
t = get_proper_type(expand_type_by_instance(typ, itype))
Expand All @@ -564,8 +563,7 @@ def analyze_var(name: str,
if mx.is_lvalue:
if var.is_property:
if not var.is_settable_property:
if info.get('__setattr__') is None:
mx.msg.read_only_property(name, itype.type, mx.context)
mx.msg.read_only_property(name, itype.type, mx.context)
else:
mx.msg.cant_assign_to_method(mx.context)

Expand Down
1 change: 0 additions & 1 deletion 1 mypy/test/testcheck.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@
'check-reports.test',
'check-errorcodes.test',
'check-annotated.test',
'check-setattr.test',
'check-parameter-specification.test',
]

Expand Down
39 changes: 0 additions & 39 deletions 39 test-data/unit/check-setattr.test

This file was deleted.

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