Skip to content

Comments

Handle malformed release versions in docs versions view#2935

Closed
adityagiri3600 wants to merge 2 commits intopython:mainfrom
adityagiri3600:fix/docs-versions-malformed-release
Closed

Handle malformed release versions in docs versions view#2935
adityagiri3600 wants to merge 2 commits intopython:mainfrom
adityagiri3600:fix/docs-versions-malformed-release

Conversation

@adityagiri3600
Copy link

Description

  • Skip malformed release versions in DocsByVersionView when a release name does not include at least major.minor parts.
  • Add a regression test to ensure /doc/versions/ still returns HTTP 200 when such a release exists.

Closes

@hugovk
Copy link
Member

hugovk commented Feb 22, 2026

Is this about https://www.python.org/doc/versions/ ?

What exactly is malformed?

@adityagiri3600
Copy link
Author

adityagiri3600 commented Feb 22, 2026

Yes.

By malformed I mean an incomplete release version that still matches the current regex like Python 4 matches Python ([\d.]+), but it doesn’t include at least major.minor. So full_version.split(".") has only one element, and the previous code accessed version_parts[1], which can raise IndexError and break the page.

If you prefer not to accept major only strings at all, I can update this to tighten parsing instead like require X.Y or X.Y.Z via a stricter regex instead of IndexError.

@hugovk
Copy link
Member

hugovk commented Feb 22, 2026

I don't think this is needed, we'll never have a simple Python X release.

Python releases (with docs) are always X.Y.Z, and in the past we've had X.Y (the last was in 2011).

(Pre-releases can have a1, b1, rc1 suffixes, but they don't have docs.)

@adityagiri3600
Copy link
Author

That makes sense, I appreciate this review. I'll close this PR.

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.

2 participants