gh-154317: Add test for parse_qsl/parse_qs strict_parsing on malformed fields#154207
gh-154317: Add test for parse_qsl/parse_qs strict_parsing on malformed fields#154207nikolauspschuetz wants to merge 1 commit into
Conversation
|
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
5bd2489 to
8995d88
Compare
|
This is a test-only change (adds coverage under |
8995d88 to
bf15955
Compare
|
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
bf15955 to
476fae1
Compare
|
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
476fae1 to
ce9972e
Compare
|
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
…lformed fields The strict_parsing=True path in urllib.parse.parse_qsl and parse_qs was only exercised with empty inputs, which return before the parsing loop, so its ValueError branch was untested. Add tests that a field without "=" raises, whether it is a bare name or an empty field (from a doubled, leading, or trailing separator), for str and bytes. The empty-field case also covers the guard that stops strict mode from silently skipping empty fields. Assert the boundary too: a field is accepted whenever it contains "=", even with an empty name or value, and well-formed input still parses.
ce9972e to
6a1628a
Compare
|
Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool. If this change has little impact on Python users, wait for a maintainer to apply the |
Add test coverage for the
strict_parsing=Truebranch ofurllib.parse.parse_qslandparse_qs.The existing
strict_parsingtests only pass empty inputs ("",b""), which return early before the parsing loop, so theValueErrorbranch for a malformed field — one without=— was never exercised. This adds a test that:=raisesValueErrorunderstrict_parsingfor bothstr('a=1&b&c=3') andbytes(b'a=1&b') inputs, andstrict_parsing.Test-only change; no behavior change. The asserted behavior is identical across CPython 3.9–3.14.