Closed
Description
urllib.parse.parse_qsl()
returns []
for any false value. There were no tests for this, so it was broken by accident in #115771 and restored in #116764.
Historically, the special case was needed to circumvent the fact that ''.split('&')
returns ['']
instead of []
. parse_qsl('')
and parse_qsl(b'')
should return []
. But zero numbers and empty sequences (like parse_qsl(0)
and parse_qsl([])
) should be errors. So I propose to deprecate the current behavior for general false values and make them errors in future.
There is an open question about None. There is a code in the wild that expects parse_qsl(None)
to work. Although it is not difficult to add workarounds for this, it may be more convenient if None
is accepted as a valid value.
Linked PRs
Metadata
Metadata
Assignees
Labels
No labels