Repository navigation
⚡ Faster form parsing
This release reduces parser overhead for forms with many fields and corrects multipart boundary and header handling. Parsers created without callbacks also no longer share callback registrations.
pip install python-multipart==0.0.34- Faster query-string parsing (#372). The parser reuses separator positions and starts the next field directly when its data is already available.
- Less overhead for multipart forms (#370, #373). Complete CRLF sequences are consumed without stepping through each intermediate parser state, and mark-helper functions are no longer created on each write.
🧩 More predictable multipart handling
- Padded boundaries no longer merge adjacent parts (#363). Spaces and tabs after delimiters between parts are recognized as transport padding. Malformed padding now raises
MultipartParseErrorinstead of being returned as part data. Padded opening boundaries remain unsupported. - Non-ASCII parameter bytes are preserved (#364).
parse_options_headertrims only spaces and tabs, rather than all Unicode whitespace. This avoids changing parameter values such as names ending in the UTF-8 bytes forà. - Whitespace around part header values is ignored by
FormParser(#366). For example,Content-Transfer-Encoding: base64is recognized and decoded despite the trailing space. Low-levelMultipartParsercallbacks still receive the raw header value bytes.
🛡️ Isolated callbacks and clearer security scope
- Callback registrations stay with their parser (#362). Parsers constructed without
callbacksnow get separate dictionaries, so callingset_callback()on one no longer changes another parser's handlers. - A documented threat model (#358, #359, #367). The threat model defines trust boundaries, application responsibilities, and vulnerability scope. Bugs in deprecated
Content-Transfer-Encodingdecoding are handled as public bug reports rather than security reports.
💜 Thank you
Thanks to @deadstrobe5 and @g4lb for the parser performance proposals that informed this release.
Full changelog: 0.0.33...0.0.34