Skip to content

Fix sphinx-doc__sphinx-9711#14387

Closed
piyushhhxyz wants to merge 1 commit intosphinx-doc:masterfrom
piyushhhxyz:fix-sphinx-doc__sphinx-9711
Closed

Fix sphinx-doc__sphinx-9711#14387
piyushhhxyz wants to merge 1 commit intosphinx-doc:masterfrom
piyushhhxyz:fix-sphinx-doc__sphinx-9711

Conversation

@piyushhhxyz
Copy link
Copy Markdown

Fix: needs_extensions checks versions using strings

Problem

The needs_extensions check in sphinx/extension.py compared version strings lexicographically (reqversion > extension.version). This causes incorrect rejections when version numbers have components >= 10, e.g., '0.6' > '0.10' is True as a string comparison, but 0.6 < 0.10 semantically.

Fix

Changed the version comparison on line 54 of sphinx/extension.py to use packaging.version.parse() for proper semantic version comparison instead of raw string comparison.

Changes

  • sphinx/extension.py: Import packaging.version.parse and use it to compare reqversion and extension.version in verify_needs_extensions().

Testing

Verified that parse_version('0.6') > parse_version('0.10') correctly returns False (whereas string comparison '0.6' > '0.10' incorrectly returns True).

The needs_extensions check was comparing version strings lexicographically, which incorrectly rejects versions like 0.10.0 when 0.6.0 is required (since '0.6' > '0.10' as strings). Now uses packaging.version.parse for proper semantic version comparison.
@piyushhhxyz piyushhhxyz deleted the fix-sphinx-doc__sphinx-9711 branch April 11, 2026 01:47
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