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 0d7b200
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 the func a parse's own registry
resolves it against, not from the func held in a directly-constructed
schema's flags. A QuickStartRequestOption or QuickStartReportOption built
directly with an unassigned func reaches this method's own check regardless,
and a parse reaches it too once a caller registers a schema against that
func, 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 and through a parse once a schema is
registered against the func, 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 the 17 test methods across the two files fail on the
parent commit; the other 9 pin unchanged behaviour by design.
0 commit comments