Repository navigation
fix(protocols)!: keep pack() from rewriting the instance it is called on (#1769) - #1791
Merged
Merged
Conversation
… on (#1769) - protocol.py: pack() assigned the header it made to the instance, so UDP(srcport=1234).pack() left schema.srcport at 0 while info kept 1234. Once the instance has been parsed or constructed, the new _packing_target() hands pack() a shallow copy, so neither the header nor what make() sets on the way (TCP's connection flags) reaches it. The construction call in __post_init__ still keeps its header for unpack(). - frame.py, pcapng.py: their pack overrides make on the same target; PCAPNG's copy gets its own option counter, so re-packing a block with an only-one option no longer raises. - httpv2.py: the header is dropped only while constructing. - Docs: pack() states the contract with a versionchanged; _packing_target and Frame.pack are documented. - Tests: new unit module over Ethernet, IPv4, UDP, TCP, Frame, PCAPNG and HTTP/2; the MPTCP stale-flags case now calls make() directly. Closes #1769
Owner
Author
|
Verdict: GOOD TO GO at |
This was referenced Oct 15, 2026
JarryShaw
added a commit
that referenced
this pull request
Oct 15, 2026
…1803) Entries: - add #1791 (breaking: pack() leaves its instance unchanged), #1778 (Protocol in protocol.__all__), #1781 (PortEnumField miss with a nameless proto), #1779 (vendor.ipx _path), #1780 (examples READMEs to Markdown, build leftovers) and #1790 (36 ambiguous cross-references) - fold #1776 into the RPL 0x23 entry and #1381 into the dump-schema one Accuracy: - the benchmark and legacy_smoke READMEs are README.md since #1780 - EngineBase stays out of __all__, as #1016 settled - the #575 peek calls get() only once the value resolves - the #647 and #764 entries point at #775/#860, under which nothing mints - the #861 entry names #869 and #874 for the EnumRegistry move Figures: - preamble: 685 citations, #340 to #1791 - process.rst pin: 298 entries; CHANGELOG.md regenerated Refs #1103
JarryShaw
added a commit
that referenced
this pull request
Oct 15, 2026
Prose only: with every string expression statement blanked, each changed module's AST is identical to origin/main's. - RFC 959: the case-folding rule sits in Section 5.3, not 4.1, in the #896 and #903 modules (RFC text, line 2559). - Counts: the release-gate mutation table's #966 block is six rows, not five; the comment now sums to the table's 21. - pack(): the GH-452 HTTP docstring describes pack() as it is after #1791, building on _packing_target(); the MPTCP stale-flags case says make, which it calls. - Line references re-measured against origin/main: 23 pointers in 14 files, into protocol.py, frame.py, field.py, byteorder.py, the five UnsupportedCall sites, tcp.py, ipv6.py, extension_header.py, the pcapng schema, apptype.py and vendor/__main__.py. Refs #1103
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.
Please follow the guide below
You will be asked some questions, please read them carefully and answer honestly
Put an
xinto all the boxes [ ] relevant to your pull request (like that [x])Use Preview tab to see how your pull request will actually look like
Searched for similar pull requests
Followed the coding style (
make pylint,make mypy,make isort)make testpasses, and a test case covers the change. Narrow runs only, listed below.Added a changelog entry under
docs/source/changelog/and regeneratedCHANGELOG.md, if the change is user-visible: N/A — centralised in docs(changelog): shared 1.5.0 changelog — long-lived, merges last (#610, #616, #617, #618, #620) #657What is the purpose of your pull request?
Tick the commit type your subject line carries.
fix— corrects a defectfeat— adds a featureperf— changes performance, not behaviourrefactor— changes neither behaviour nor performancetest— tests onlydocs— documentation onlyci— workflows or build toolingrelease— bumps the version or rolls up a distributionchore— anything elseSummary
pack()assigned the header it built to the instance, soUDP(srcport=1234).pack()leftschema.srcportat 0 whileinfo.srcportkept 1234. 1.4.1.post2 did the same. Per the owner's choice (option A on #1769),pack()with no keywords now builds a fresh header and leaves a parsed or constructed instance unchanged.protocol.py: once the instance exists,_packing_target()givespack()a shallow copy, so neither the header nor statemake()sets (TCP's connection flags) reaches the instance. Construction still keeps its header forunpack().frame.py,pcapng.py,httpv2.py: their overrides had the same defect. PCAP-NG's copy also gets its own option counter, so re-packing a block with an only-one option no longer raises.pack()states the contract, withversionchanged:: 1.5.0.pack()re-syncingschemanow has to callmake()or reconstruct.pcapkit/reverted the new module fails 17 tests; reverting each override fails its own test.Closes #1769