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
{{ message }}
Repository navigation
Commit d0fd8cd
Browse filesBrowse the repository at this point in the historyBrowse files
fix(protocols): makers name the rejected argument and value in error messages
Several _make_* builders rejected a bad caller-supplied argument with the
reader's parse-error text ("invalid format"), which gives no indication of
which argument was wrong or what value triggered it. #2296.
- sctp.py: all 11 identical `len(flags) != 1` guards across the chunk
makers, plus _make_chunk_data's empty-data guard, _make_param_hostname's
NUL-termination guard, and _make_cause_invalid_stream's reserved-length
guard.
- mh.py: make()'s unsupported-data-type guard, _make_opt_bad/_make_opt_auth's
length guards, _make_opt_badf's empty-data guard, and _make_opt_pad's
Pad1-length warning. Added the missing Raises:/Warns: docstring sections.
- tcp.py: _make_mptcp_capable now names which optional field was given
without its predecessor.
- hip.py: _make_locator's fallback branch (the one site #2276 missed).
- pcapng.py: _make_block_dsb's fallback branch (the one site #2273 missed).
_make_chunk_data's flags= example in the issue doesn't match any real
parameter on that method (it takes reserved/I/U/B/E, not flags), so its
exact wording was applied to the 11 makers that do take flags, and
_make_chunk_data got a data-shaped message instead.
Test: tests/protocols/test_maker_invalid_format_messages_2296_unit.py (new,
22 tests/82 subtests, one class per site group); confirmed 66 failed/20
passed against unpatched pcapkit, each failure a message-text mismatch.
tests/protocols/ in full: 2011 passed/51370 subtests/0 failed. mypy and
pylint findings on the 5 touched files are unchanged from main.
Four other maker-side sites still use the generic text but aren't in
#2296's checklist -- HOPOPT._make_opt_pad, IPv6_Opts._make_opt_pad,
HTTP.make, PCAPNG.make -- tracked separately rather than folded in here.
0 commit comments