github Kludex/python-multipart 0.0.34
Version 0.0.34

34 minutes ago

⚡ 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 MultipartParseError instead of being returned as part data. Padded opening boundaries remain unsupported.
  • Non-ASCII parameter bytes are preserved (#364). parse_options_header trims 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: base64 is recognized and decoded despite the trailing space. Low-level MultipartParser callbacks still receive the raw header value bytes.

🛡️ Isolated callbacks and clearer security scope

  • Callback registrations stay with their parser (#362). Parsers constructed without callbacks now get separate dictionaries, so calling set_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-Encoding decoding 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

Don't miss a new python-multipart release

NewReleases is sending notifications on new releases.