urllib.parse.parse_qs should not parse a query string containing illegal characters
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 77.2k
- Forks
- 35.9k
- PR merge metrics
- PR metrics pending
Description
Bug report
Bug description:
urllib.parse.parse_qsl will happily parse a query string containing '#'.
from urllib.parse import parse_qsl
parse_qsl('foo=#', strict_parsing=True)
Output is [('foo', '#')] .
But 'foo=#' is an invalid query string according to RFC 3986. Similarly, '[', and ']' are excluded from the set of valid query characters, but parse_qsl parses strings like 'foo=[' and 'foo=]' . In the absence of any allocation of responsibility, this looks like a bug to me.
CPython versions tested on:
3.13
Operating systems tested on:
macOS
Linked PRs
- gh-152530
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at urllib.parse.parse_qsl and review how query characters are validated against RFC 3986. Check the existing parsing tests and the linked PR gh-152530 first; done means illegal characters such as '#', '[' and ']' are handled consistently with the agreed behavior and covered by tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend-api-design
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100