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 993f4a2
Browse filesBrowse the repository at this point in the historyBrowse files
refactor: remove two unreachable branches, commented-out raises and unused test helpers (#2318)
Problem: two guards could never run, because something earlier had already
raised -- Header.read's FileError on an unknown magic number, which the
schema's magic_number_callback beats to it; and _read_opt_calipso's two
length guards, which calipso_pad_len beats to it while the option is
unpacked. Beside them sat commented-out raise lines next to the warn that
replaced them, a repeated pylint: disable=unused-argument, and three names
nothing read: dispatch.py's _internet_enum, a FAKE_GH query no caller sends,
and GATING.
A third candidate, _read_opt_qs's unknown QS function arm, looked
unreachable the same way but is not: the unassigned-option dispatch it
depends on is by schema class, decided from octets a file read hands the
option, not from the function value. A QuickStartRequestOption or
QuickStartReportOption built directly with an unassigned func reaches this
method's own check regardless, so it stays, with a Note on each of the three
readers explaining why.
Fix: the two genuinely unreachable guards are deleted, with the prose that
described them corrected -- Header.read documents ProtocolError, and
_read_opt_calipso documents what checked the length instead. The three
fabricated-schema stanzas that reached the deleted guards by calling a
private reader directly are replaced by the real parse paths, which raise as
before.
Test: tests/protocols/test_dead_branches_2318_unit.py parses what was
supposed to reach each deleted branch and pins what happens instead, pins
the restored QS guard against both schema kinds across all three protocols
through the public construction path (not just the private reader), and
pins the source as holding no such deleted branch, no commented-out raise
beside a warn, and no repeated pragma; tests/project/test_dead_helpers_2318_unit.py
pins the rule that made each helper dead. 8 of 14 test methods in the first
file fail on the parent commit; the other 6 pin unchanged behaviour by
design.
0 commit comments