Skip to content

Lint: Validate every version in the Python-Version header - #5221

Merged
hugovk merged 1 commit into
python:mainfrom
RaphaelFakhri:check-peps-python-version-continue
Nov 8, 2026
Merged

hugovk merged 1 commit into
python:mainfrom
RaphaelFakhri:check-peps-python-version-continue

Conversation

@RaphaelFakhri

Copy link
Copy Markdown
Contributor

check-peps.py splits Python-Version into a comma-separated list, but _validate_python_version() ends with return when a version has no micro part. The first two-segment version (for example 3.12) stops the generator, so later versions in the list are never checked.

For example, these headers pass the linter today:

Python-Version: 3.12, 4.0
Python-Version: 3.x, 3.01
Python-Version: 2.7, 3.0.a

This change replaces the return with continue, so each version gets the same checks as a single-version header. It also adds a test for multi-version headers. The existing parametrized test builds the expected message from the whole line, so it only covers single versions.

All current PEPs still pass python check-peps.py.

@hugovk hugovk added the lint Linter-related work and linting fixes on PEPs label Nov 8, 2026
@hugovk
hugovk merged commit efec260 into python:main Nov 8, 2026
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lint Linter-related work and linting fixes on PEPs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants