Skip to content

Commit 9d7a699

Browse files
[3.7] Adding Doc/library entries for max_num_fields
(cherry picked from commit 6580698e13) Co-authored-by: Matt Belisle <[email protected]>
1 parent f51ef51 commit 9d7a699

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

Doc/library/urllib.parse.rst

Lines changed: 15 additions & 3 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,16 +158,22 @@ 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 a flag for the maximum number of
162+
fields to read. If set, then throws a :exc:`ValueError` if there are more
163+
than *max_num_fields* fields read. Default is *None*.
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.
164168

165-
166169
.. versionchanged:: 3.2
167170
Add *encoding* and *errors* parameters.
168171

172+
.. versionchanged:: 3.7.2
173+
Added *max_num_fields* param.
169174

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

172178
Parse a query string given as a string argument (data of type
173179
:mimetype:`application/x-www-form-urlencoded`). Data are returned as a list of
@@ -187,12 +193,18 @@ or on combining URL components into a URL string.
187193
percent-encoded sequences into Unicode characters, as accepted by the
188194
:meth:`bytes.decode` method.
189195

196+
The optional argument *max_num_fields* is a flag for the maximum number of
197+
fields to read. If set, then throws a :exc:`ValueError` if there are more
198+
than *max_num_fields* fields read. Default is *None*.
199+
190200
Use the :func:`urllib.parse.urlencode` function to convert such lists of pairs into
191201
query strings.
192202

193203
.. versionchanged:: 3.2
194204
Add *encoding* and *errors* parameters.
195205

206+
.. versionchanged:: 3.7.2
207+
Added *max_num_fields* param.
196208

197209
.. function:: urlunparse(parts)
198210

0 commit comments

Comments
 (0)