Skip to content

Commit 68f3237

Browse files
matthewbelisle-wfvstinner
authored andcommitted
bpo-35116, urllib.parse: Document the new max_num_fields parameter (pythonGH-10247)
1 parent a80af77 commit 68f3237

1 file changed

Lines changed: 16 additions & 2 deletions

File tree

Doc/library/urllib.parse.rst

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ or on combining URL components into a URL string.
137137
returning :const:`None`.
138138

139139

140-
.. function:: parse_qs(qs, keep_blank_values=False, strict_parsing=False, encoding='utf-8', errors='replace')
140+
.. function:: parse_qs(qs, keep_blank_values=False, strict_parsing=False, encoding='utf-8', errors='replace', max_num_fields=None)
141141

142142
Parse a query string given as a string argument (data of type
143143
:mimetype:`application/x-www-form-urlencoded`). Data are returned as a
@@ -158,6 +158,10 @@ or on combining URL components into a URL string.
158158
percent-encoded sequences into Unicode characters, as accepted by the
159159
:meth:`bytes.decode` method.
160160

161+
The optional argument *max_num_fields* is the maximum number of fields to
162+
read. If set, then throws a :exc:`ValueError` if there are more than
163+
*max_num_fields* fields read.
164+
161165
Use the :func:`urllib.parse.urlencode` function (with the ``doseq``
162166
parameter set to ``True``) to convert such dictionaries into query
163167
strings.
@@ -166,8 +170,11 @@ or on combining URL components into a URL string.
166170
.. versionchanged:: 3.2
167171
Add *encoding* and *errors* parameters.
168172

173+
.. versionchanged:: 3.8
174+
Added *max_num_fields* parameter.
175+
169176

170-
.. function:: parse_qsl(qs, keep_blank_values=False, strict_parsing=False, encoding='utf-8', errors='replace')
177+
.. function:: parse_qsl(qs, keep_blank_values=False, strict_parsing=False, encoding='utf-8', errors='replace', max_num_fields=None)
171178

172179
Parse a query string given as a string argument (data of type
173180
:mimetype:`application/x-www-form-urlencoded`). Data are returned as a list of
@@ -187,12 +194,19 @@ or on combining URL components into a URL string.
187194
percent-encoded sequences into Unicode characters, as accepted by the
188195
:meth:`bytes.decode` method.
189196

197+
The optional argument *max_num_fields* is the maximum number of fields to
198+
read. If set, then throws a :exc:`ValueError` if there are more than
199+
*max_num_fields* fields read.
200+
190201
Use the :func:`urllib.parse.urlencode` function to convert such lists of pairs into
191202
query strings.
192203

193204
.. versionchanged:: 3.2
194205
Add *encoding* and *errors* parameters.
195206

207+
.. versionchanged:: 3.8
208+
Added *max_num_fields* parameter.
209+
196210

197211
.. function:: urlunparse(parts)
198212

0 commit comments

Comments
 (0)