#28618·ruff

Support ability to opt out of rewriting exceptions to PEP 758 `except A, B` Py 3.14 syntax

Author: bsolomon1124Created Sep 15, 2026Updated Sep 15, 2026
Labelsformatterneeds-decisionstyle

Summary

PEP 758 / Python 3.14 support except A, B syntax for exceptions.

What we have found very consistently from real-world experience is that LLMs get tripped up on this, even when we prominently highlight this as a project convention in places like AGENTS.md + CLAUDE.md. AI/LLM code reviews consistently return the false-positive finding that exception syntax in use for the project is "Python 2 only" when in reality it is valid Python 3.14 syntax.

Stemming from this experience is a feature request: support the ability to tell ruff to disable this specific formatter behavior (re-writing except (A, B) to except A, B) while keeping target-version = "py314" or above. Currently, there is no way to "opt out".

Otherwise, the only workaround currently is to downgrade to target-version = "py313" in pyproject.toml (plus from __future__ import annotations to avoid new false-positive F821s) even when 3.14 is the real target version of our project for support & testing.

Related (though all opened claiming this reformatting behavior is an error by ruff, which it is not): #23626, #25065, #25901.