python / python/cpython

Add test coverage for parse_qsl/parse_qs strict_parsing on malformed query fields

未关闭
#154,317 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

tests type-feature
主要语言
Python
星标
77.2k
派生
35.9k
PR 合并指标
PR 指标待抓取

描述

urllib.parse.parse_qsl() and parse_qs() accept a strict_parsing keyword that, when True, raises ValueError on a malformed query field — one without a = separator, e.g. "a=1&b&c=3". This error branch is currently not exercised by Lib/test/test_urlparse.py: the existing parse_qsl/parse_qs tests only cover well-formed inputs and the default lenient behavior, so a regression that silently dropped the strict_parsing check would not be caught. It would be good to add a small test covering the strict_parsing=True branch for both functions on str and bytes inputs, alongside a well-formed control. Addressed by PR #154207.

Linked PRs
  • gh-154207

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

从 Lib/test/test_urlparse.py 开始,检查现有的 parse_qsl 和 parse_qs 测试,包括它们的 str 和 bytes 情况。确认 PR #154207 涵盖了 strict_parsing=True 对格式错误和格式正确的查询字段的处理,并使用相关的 urlparse 测试套件验证覆盖范围。

由索引模型根据 Issue 内容生成。

评估

技术栈
python
领域
testing-qa
Issue 类型
缺陷
难度
2/5
预计耗时
1-3 小时
活跃度
停滞
描述清晰度
描述清楚
新手友好度
25/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。