Repository navigation
fix(corekit): pickle an Info or Schema under protocols 0 and 1 through the protocol-2 reduction (#2714) - #2722
Merged
Merged
Conversation
Owner
Author
|
GOOD TO GO at
|
Owner
Author
|
let's name the module |
Owner
Author
|
Ruling taken. Three changes:
The original worker is amending this PR. |
JarryShaw
force-pushed
the
fix/2714-pickle-protocol-2
branch
from
November 3, 2026 04:08
e2a5d7a to
30f3ada
Compare
Owner
Author
|
Pushed
A Sonnet re-review is running; |
Owner
Author
|
GOOD TO GO at
|
…, protocol 2's for Generic classes (#2714) Below protocol 2, object.__reduce_ex__ hands an instance to copyreg._reduce_ex, whose MRO walk stops at the first non-heap base and calls it on the instance. GraalPy builds typing.Generic as a built-in, so the walk stopped at Generic and raised "typing.Generic() takes no arguments" for every Info, Schema and reassembly engine. - pcapkit.utilities.pickle holds the reductions classes had each written: ReduceAsProtocol2 (protocol 2's under every protocol), ReduceToName (a singleton's global name), ReduceToItems (a call on the item pairs) and reduce_to (a per-instance reducer). - Info, Schema, ReassemblyBase, Deferred and FrameRecord take ReduceAsProtocol2, and Deferred drops a __getstate__ matching Python's default; Sentinel and multidict's missing marker take ReduceToName; OrderedMultiDict and MultiInfo take ReduceToItems; the unregistered enum members of EnumRegistry and EnumField use reduce_to. - New tests stand in GraalPy's walk for copyreg._reduce_ex on CPython; the MH timestamp and sentinel tests drop their GraalPy protocol-2 floor, and the TCP datagram pickle test runs every protocol. Pickling never resolved the deferred packet: pytest's failure report renders the datagram with repr, which does, so the tests that pickle one datagram under each protocol found it resolved after protocol 0 failed.
JarryShaw
force-pushed
the
fix/2714-pickle-protocol-2
branch
from
November 3, 2026 04:30
30f3ada to
e85ef22
Compare
Owner
Author
|
Fold pushed:
The verdict stays GOOD TO GO. This delta is the reviewer's own suggestion, applied. |
JarryShaw
added a commit
that referenced
this pull request
Nov 3, 2026
…s.pickle, FRAD's pad and the TCP and HIP maker fixes into 1.6.0 (#2449) - Breaking: a fixed-size octet field given any other width raises, where 1.5.x padded or cut it, and IPv4's Timestamp option refuses a slot count past what it holds, where 1.5.x cut it (#2691); folded into the IPv4 to HIP makers' range-check entry, with the ZigBee keys into the PCAP-NG entry. Old values measured against v1.5.1. - Added: pcapkit.utilities.pickle, whose ReduceAsProtocol2 lets Info, Schema and the reassembly engines pickle under protocols 0 and 1 on GraalPy, and numbers._reduce_unregistered_member's removal (#2722). - Fixed: TCP's raw-octet options, HIP's default version, HIP's ENCRYPTED IV and its cipher on parse (#2724). - Folded into unreleased entries: FRAD's pad field and make(pad=) (#2721). - No entry for the docstring-only 596dcfa, the test-only 149cced, or #2724's MH annotation. - CHANGELOG.md regenerated; util/changelog_md.py --check passes.
1 of 5 tasks
JarryShaw
added a commit
that referenced
this pull request
Nov 3, 2026
#2704 and #2722 - protocol.rst linked pad_length at pcapkit.corekit.fields.strings, its home before #2704; it links pcapkit.corekit.schema.padding now. - protocol.rst documented Protocol._make_uint twice, beside _make_index and among the value helpers; the value-helper entry stays, in the Protocol autoclass, the ProtocolBase method group and its link list alike. - ReduceAsProtocol2 names copyreg._reduce_ex and copyreg.__newobj__ as literals, since intersphinx holds neither private name. - HIP and IPv6_Route filed their #2676 note under versionremoved 1.6.0; it moves, unreworded, into each class's versionchanged 1.6.0 list. Docstrings and .rst only; the AST is equal once docstrings are stripped.
This was referenced Nov 3, 2026
JarryShaw
added a commit
that referenced
this pull request
Nov 3, 2026
) (#2748) The owner asked to rename the module holding `lazy_exports`. `importlib` follows the stdlib-domain naming `pcapkit.utilities.pickle` set (#2722); `imp` was passed over as the name of the stdlib module Python 3.12 removed. `lazy_exports` keeps its name. Every `pcapkit.const` package imports it from the new path, and the API page (renamed with its toctree entry), the const-vendor pairing convention and the tests follow. The old path never shipped, so it gets no re-export, no shim and no deprecation note. The module's own `import importlib` is absolute, so it still binds the standard library module, and `sys.modules['importlib']` is unchanged after `import pcapkit`.
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)make testpasses, and a test case covers the changeWhat is the purpose of your pull request?
fix— corrects a defectOn GraalPy, no
Info,Schemaor reassembly engine can be pickled under protocol 0 or 1. Below protocol 2,copyreg._reduce_exwalks the bases to the first one that is not a heap type and calls it. On GraalPy that base istyping.Generic, so the call raisesTypeError: typing.Generic() takes no arguments. That is 32 of the 80 GraalPy reassembly failures. The other 48 come from pytest'sreprof the failing frame, which resolves theDeferredPacket; pickling never mutates the original.pcapkit.utilities.pickling.ReduceAsProtocol2, whose__reduce_ex__uses the protocol-2 reduction for every protocol.Info,SchemaandReassemblyBasetake it. There is no GraalPy-specific branch.ProtocolBase,FieldBase,ExtractorandTraceFlowBaseare left alone, because they fail on CPython too: they hold aBytesIO, a lambda or a local class.mainand this PR in both directions, at protocols 0, 1, 2 and 5. TheNO_VALUEsentinel identity holds, and a subclass's own__reduce__still wins.main. The GraalPy gates in the 1842 and 1886 tests are removed and the 2417 test is widened, so this PR's GraalPy leg exercises protocols 0 and 1 directly.The mixin is public and documented, as the other
pcapkit.utilitieshelpers are. The review suggested_ReduceAsProtocol2as an option; say if you prefer that.Closes #2714