mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-04 07:35:01 +00:00
## Summary Pull this out of https://github.com/astral-sh/ruff/pull/18473 as an isolated change to make sure it has no adverse effects. The wrong behavior is observable on `main` for something like ```py class C: def __new__(cls) -> "C": cls.x = 1 C.x # previously: Attribute `x` can only be accessed on instances # now: Type `<class 'C'>` has no attribute `x` ``` where we currently treat `x` as an *instance* attribute (because we consider `__new__` to be a normal function and `cls` to be the "self" attribute). With this PR, we do not consider `x` to be an attribute, neither on the class nor on instances of `C`. If this turns out to be an important feature, we should add it intentionally, instead of accidentally. ## Test Plan Ecosystem checks. |
||
|---|---|---|
| .. | ||
| resources | ||
| src | ||
| tests | ||
| build.rs | ||
| Cargo.toml | ||
| mdtest.py | ||
| mdtest.py.lock | ||