66
77https://multipart.readthedocs.io/
88
9- Copyright (c) 2010-2025 , Marcel Hellkamp
9+ Copyright (c) 2010-2026 , Marcel Hellkamp
1010License: MIT (see LICENSE file)
1111"""
1212
13-
1413__author__ = "Marcel Hellkamp"
1514__version__ = "1.4.0-dev"
1615__license__ = "MIT"
4039 Tuple ,
4140 List ,
4241 Callable ,
43- Awaitable
42+ Awaitable ,
4443)
4544
4645from urllib .parse import unquote_plus as _unquote_plus
@@ -479,7 +478,6 @@ def parse(self, chunk: t_ByteString) -> Generator[t_ParserEvent, None, None]:
479478 offset = 0
480479
481480 while True :
482-
483481 if self ._state is _PREAMBLE :
484482 # Scan for first delimiter (CRLF prefix is optional here)
485483 index = buffer .find (delimiter [2 :], offset )
@@ -541,7 +539,6 @@ def parse(self, chunk: t_ByteString) -> Generator[t_ParserEvent, None, None]:
541539 break # wait for more data
542540
543541 elif self ._state is _BODY :
544-
545542 # Ensure there is enough data in buffer to fit a delimiter
546543 if offset + d_len + 2 > bufferlen :
547544 break # wait for more data
@@ -890,6 +887,9 @@ def __init__(
890887 data as needed to return the next part. Results are cached and the same
891888 part can be requested multiple times without extra cost.
892889
890+ Note that you should either set `partsize_limit` or `disk_limit` depending
891+ on your specific requirements. Both are unlimited by default.
892+
893893 :param stream: A readable byte stream or any other object that implements
894894 a :meth:`read(size) <io.BufferedIOBase.read>` method.
895895 :param boundary: The multipart boundary as found in the Content-Type header.
@@ -901,7 +901,7 @@ def __init__(
901901 :param header_limit: Maximum number of headers per part.
902902 :param headersize_limit: Maximum length of a single header line (name and value).
903903 :param part_limit: Maximum number of parts.
904- :param partsize_limit: Maximum content size of a single parts .
904+ :param partsize_limit: Maximum content size of a single part .
905905 :param spool_limit: Parts up to this size are buffered in memory and count
906906 towards `memory_limit`. Larger parts are spooled to temporary files on
907907 disk and count towards `disk_limit`.
@@ -970,7 +970,7 @@ def _iterparse(self):
970970 max_segment_count = self .part_limit ,
971971 max_segment_size = self .partsize_limit ,
972972 header_charset = self .charset ,
973- strict = self .strict
973+ strict = self .strict ,
974974 )
975975
976976 with parser :
0 commit comments