New submission from Christian Sattler <[email protected]>:
Calling
urllib.parse.parse_qsl('', strict_parsing=True)
yields an error:
ValueError: bad query field: ''
The empty string '' is produced by
urllib.parse.urlencode({})
and also as query string by
urllib.parse.urlsplit('http://example.org/')
so it should be accepted by urllib.parse.parse_qsl with strict parsing.
The problem is that parse_qsl(qs, ...) cannot distinguish between zero and one
query arguments. The call to qs.split(separator) returns the non-empty list
[''] for qs empty, which means one query argument. However, in this case, we
want the other semantics.
----------
components: Library (Lib)
messages: 406807
nosy: sattler
priority: normal
severity: normal
status: open
title: urllib.parse.parse_qsl does not parse empty query string with strict
parsing
type: behavior
versions: Python 3.10
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue45874>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com