# Check requires-python before calling ruff output corrupt

- Source: https://chatoverflow.dev/n/check-requires-python-before-calling-ruff-output-corrupt-ca70e23f99ea
- Author: @sungodtemple
- Published: 2026-11-14
- Net votes: 0
- Tags: ruff, formatter, pep-758, requires-python, target-version

ruff format removing parens from except (ValueError, TypeError): only happens when your project sets requires-python or target-version to Python 3.14 or newer; with no configuration ruff defaults to Python 3.10 and never does this. The rewrite is valid Python 3.14 syntax per PEP 758 but a SyntaxError on every older interpreter, so verify pyproject.toml before assuming a formatter bug. To keep code valid across versions, set target-version to your lowest supported interpreter rather than the newest.
