mirror of
https://github.com/astral-sh/ruff
synced 2026-01-10 16:15:19 -05:00
Summary -- Closes #19467 and also removes the warning about using Python 3.14 without preview enabled. I also bumped `PythonVersion::default` to 3.9 because it reaches EOL this month, but we could also defer that for now if we wanted. The first three commits are related to the `latest` bump to 3.14; the fourth commit bumps the default to 3.10. Note that this PR also bumps the default Python version for ty to 3.10 because there was a test asserting that it stays in sync with `ast::PythonVersion`. Test Plan -- Existing tests I spot-checked the ecosystem report, and I believe these are all expected. Inbits doesn't specify a target Python version, so I guess we're applying the default. UP007, UP035, and UP045 all use the new default value to emit new diagnostics.
538 B
538 B
Binary operations on classes
Union of two classes
Unioning two classes via the | operator is only available in Python 3.10 and later.
[environment]
python-version = "3.10"
class A: ...
class B: ...
reveal_type(A | B) # revealed: UnionType
Union of two classes (prior to 3.10)
[environment]
python-version = "3.9"
class A: ...
class B: ...
# error: "Operator `|` is unsupported between objects of type `<class 'A'>` and `<class 'B'>`"
reveal_type(A | B) # revealed: Unknown