🛡️ Safer form parsing
This release lets you cap URL-encoded form fields as they stream in, and fixes several upload and decoding edge cases. It also drops Python 3.10 and adds Python 3.15.
pip install python-multipart==0.0.33- Limit URL-encoded fields while streaming (#333). The new opt-in
MAX_FIELDSandMAX_FIELD_SIZEoptions forFormParserraiseFormParserErrorbefore oversized data is buffered. Both default to no limit, and multipart forms are unaffected. - Nameless uploads no longer crash when spilled to disk (#343). Uploads without a filename used to raise
AttributeErrorwhenUPLOAD_KEEP_EXTENSIONSorUPLOAD_KEEP_FILENAMEwas set. UPLOAD_DIRacceptsstrwithUPLOAD_KEEP_FILENAME(#335). Astrupload directory used to fail on the first write to disk.- Decoded data is complete before callbacks run (#336, #355).
Content-Transfer-Encodingdecoders are finalized at the end of each part, and quoted-printable escapes split across writes decode correctly. parse_options_headerlowercases content types with parameters (#287).Multipart/Form-Data; boundary=abcnow returnsmultipart/form-data, the same as headers without parameters.
⚡ Faster parsing
- Faster opening boundary matching (#328). Complete boundaries are matched in one step.
- Faster parser state lookups (#330). Parser states are module-level enum members, so their
repris nowmultipart.ENDinstead of<MultipartState.END: 12>. - Faster querystring callback dispatch (#316).
🐍 Python support
- Python 3.10 is no longer supported (#329). Python 3.11 is now the minimum.
- Python 3.15 is supported (#350).
💜 Thank you
Thanks to @Edneam, @sungbin1015, @carlok, and @fjvbn2003 for contributing to this release.
Thanks to the individual sponsors who contributed $134.00 to support this work. If python-multipart is useful to you, consider sponsoring me on GitHub.
Full changelog: 0.0.32...0.0.33