mirror of
https://github.com/astral-sh/ruff.git
synced 2025-10-05 16:10:36 +00:00
![]()
Some checks are pending
CI / cargo test (linux) (push) Blocked by required conditions
CI / Determine changes (push) Waiting to run
CI / cargo fmt (push) Waiting to run
CI / cargo clippy (push) Blocked by required conditions
CI / cargo test (linux, release) (push) Blocked by required conditions
CI / cargo test (windows) (push) Blocked by required conditions
CI / cargo test (wasm) (push) Blocked by required conditions
CI / cargo build (release) (push) Waiting to run
CI / mkdocs (push) Waiting to run
CI / cargo build (msrv) (push) Blocked by required conditions
CI / cargo fuzz build (push) Blocked by required conditions
CI / fuzz parser (push) Blocked by required conditions
CI / test scripts (push) Blocked by required conditions
CI / ecosystem (push) Blocked by required conditions
CI / Fuzz for new ty panics (push) Blocked by required conditions
CI / cargo shear (push) Blocked by required conditions
CI / python package (push) Waiting to run
CI / pre-commit (push) Waiting to run
CI / formatter instabilities and black similarity (push) Blocked by required conditions
CI / test ruff-lsp (push) Blocked by required conditions
CI / check playground (push) Blocked by required conditions
CI / benchmarks-instrumented (push) Blocked by required conditions
CI / benchmarks-walltime (push) Blocked by required conditions
[ty Playground] Release / publish (push) Waiting to run
fix https://github.com/astral-sh/ty/issues/1047 ## Summary This PR fixes how `KW_ONLY` is applied in dataclasses. Previously, the sentinel leaked into subclasses and incorrectly marked their fields as keyword-only; now it only affects fields declared in the same class. ```py from dataclasses import dataclass, KW_ONLY @dataclass class D: x: int _: KW_ONLY y: str @dataclass class E(D): z: bytes # This should work: x=1 (positional), z=b"foo" (positional), y="foo" (keyword-only) E(1, b"foo", y="foo") reveal_type(E.__init__) # revealed: (self: E, x: int, z: bytes, *, y: str) -> None ``` <!-- What's the purpose of the change? What does it do, and why? --> ## Test Plan <!-- How was it tested? --> mdtests |
||
---|---|---|
.. | ||
dataclass_transform.md | ||
dataclasses.md | ||
fields.md |