You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=Nonecreated_at=<Date2021-11-22.22:35:40.875>labels= ['type-bug', 'library', '3.10']
title='urllib.parse.parse_qsl does not parse empty query string with strict parsing'updated_at=<Date2021-12-12.08:41:19.198>user='https://github.com/sattlerc'
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.
New changeset e6fe10d by Christian Sattler in branch 'main': bpo-45874: Handle empty query string correctly in urllib.parse.parse_qsl (bpo-29716) e6fe10d
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: