Skip to content

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

Open
RaphaelFakhri wants to merge 1 commit into
python:mainfrom
RaphaelFakhri:check-peps-python-version-continue
Open

RaphaelFakhri wants to merge 1 commit into
python:mainfrom
RaphaelFakhri:check-peps-python-version-continue

Conversation

@RaphaelFakhri

Copy link
Copy Markdown

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.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant