---
source: crates/red_knot_test/src/lib.rs
expression: snapshot
---
---
mdtest name: attribute_assignment.md - Attribute assignment - Data descriptors - Invalid `__set__` method signature
mdtest path: crates/red_knot_python_semantic/resources/mdtest/diagnostics/attribute_assignment.md
---

# Python source files

## mdtest_snippet.py

```
 1 | class WrongDescriptor:
 2 |     def __set__(self, instance: object, value: int, extra: int) -> None:
 3 |         pass
 4 | 
 5 | class C:
 6 |     attr: WrongDescriptor = WrongDescriptor()
 7 | 
 8 | instance = C()
 9 | 
10 | # TODO: ideally, we would mention why this is an invalid assignment (wrong number of arguments for `__set__`)
11 | instance.attr = 1  # error: [invalid-assignment]
```

# Diagnostics

```
error: lint:invalid-assignment
  --> /src/mdtest_snippet.py:11:1
   |
10 | # TODO: ideally, we would mention why this is an invalid assignment (wrong number of arguments for `__set__`)
11 | instance.attr = 1  # error: [invalid-assignment]
   | ^^^^^^^^^^^^^ Invalid assignment to data descriptor attribute `attr` on type `C` with custom `__set__` method
   |

```
