Skip to content

Fix multipart version comparison for newer releases#6

Open
yashwant86 wants to merge 1 commit intomasterfrom
pr-15226
Open

Fix multipart version comparison for newer releases#6
yashwant86 wants to merge 1 commit intomasterfrom
pr-15226

Conversation

@yashwant86
Copy link
Copy Markdown

@yashwant86 yashwant86 commented Apr 7, 2026

Mirror of fastapi#15226


Summary by MergeMonkey

  • Bug Fixes:
    • Fix version comparison for python-multipart that incorrectly rejected versions like 0.0.100 due to lexicographic string comparison

Use numeric version parsing instead of string comparison so valid python-multipart
versions like 0.0.100 are not treated as older than 0.0.12. Add regression tests
for the multipart check and the version parser helper.
@mergemonkeyhq
Copy link
Copy Markdown

mergemonkeyhq Bot commented Apr 14, 2026

Changes

Files Summary
Numeric version comparison for python-multipart
fastapi/dependencies/utils.py
Replaces lexicographic string comparison of python-multipart version with numeric tuple comparison via a new `_version_str_to_tuple` helper, fixing incorrect rejection of versions like 0.0.100 (which is lexicographically less than "0.0.12" but numerically greater).
Version comparison tests
tests/test_multipart_installation.py
Adds tests for the version string-to-tuple parser covering normal versions, pre-release suffixes, empty strings, and a regression test ensuring version 0.0.100 is accepted as valid.

Sequence Diagram

sequenceDiagram
    participant App as FastAPI App
    participant Utils as dependencies/utils
    participant PM as python_multipart
    App->>Utils: ensure_multipart_is_installed()
    Utils->>PM: import __version__
    PM-->>Utils: "0.0.100"
    Utils->>Utils: _version_str_to_tuple("0.0.100")
    Utils-->>Utils: (0, 0, 100)
    Utils->>Utils: assert (0, 0, 100) > (0, 0, 12)
    Utils-->>App: OK (multipart accepted)
Loading

Dig Deeper With Commands

  • /review <file-path> <function-optional>
  • /chat <file-path> "<question>"
  • /roast <file-path>

Runs only when explicitly triggered.

@yashwant86
Copy link
Copy Markdown
Author

/review --force

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