Repository navigation
fix(pcap): a lone lilendian/bigendian flag is ignored by Header._make_magic - #1159
Merged
Merged
Conversation
…_magic _make_magic honoured the endian flags only when both were given, so Header(bigendian=True) fell back to byteorder (the host order). Either flag alone now selects the byte order and overrides byteorder; equal flags still raise EndianError. test_header_frame_unit pinned the old behaviour (bigendian=False losing to byteorder='big') and is updated. New regression module: tests/protocols/misc/pcap/test_header_lone_endian_flag_unit.py. Closes #1144
Owner
Author
|
Cross-review verdict on
|
Contributor
|
Coverage: 88.86% (unit tier, Python 3.14,
Per-file detail: the |
JarryShaw
added a commit
that referenced
this pull request
Oct 7, 2026
- 4 new 1.5.0 entries: HTTP/2 sample stream identifiers (#1161), TCP option re-padding (#1163, breaking), format='pcap' output (#1164), declared lengths on truncated captures (#1166, breaking) - extend the PCAP Header (#1159), HIP (#1160) and from_data round-trip (#1162) entries rather than duplicating them - regenerate CHANGELOG.md with util/changelog_md.py - process.rst: entry-count pin re-measured, 189 -> 193 tests/project: conventions_doc_claims, changelog_md and documentation_claims pass; changelog_md.py --check is in step.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
make pylint,make mypy,make isort) — ran pylint/mypy onheader.py: nothing on the changed lines; isort flagsheader.pyandtest_header_frame_unit.pyidentically onmain(imports untouched)make testpasses, and a test case covers the change — the modules listed below onlydocs/source/changelog/and regeneratedCHANGELOG.md, if the change is user-visible — N/A, added centrally after the waveWhat is the purpose of your pull request?
fix— corrects a defectDescription of your pull request and other information
Closes #1144.
Header._make_magichonouredlilendian/bigendianonly as a pair. Now either flag on its own picks the byte order and overridesbyteorder. Equal flags still raiseEndianError. Builds on #1143.Probe on little-endian host,
Header(**kw).data[:4], before → after:bigendian=Trued4c3b2a1→a1b2c3d4;lilendian=Falsed4c3b2a1→a1b2c3d4.New
tests/protocols/misc/pcap/test_header_lone_endian_flag_unit.py: 4 subtests fail without the fix, all pass with it.test_header_frame_unit.py:149asserted the old behaviour (byteorder='big', bigendian=False→ big), so I updated that one assertion.Passing: the new module,
test_header_frame_unit,test_header_magic_protos_unit,test_header_make_data_magic_unit,test_frame_endian_runtime,test_frame_runtime,test_construction_keyword_check_unit,test_option_roundtrip_unit,tests/project(389 passed, 1 skipped).