Repository navigation
Conversation
…s own name (#2733) Info stores a key named like one of its builtin names, such as items or a reassembled datagram's packet, under a renamed key, and finalisation adds every builtin name to __excluded__. repr and str match __excluded__ against the renamed key and write the field; the dumps matched it against the name iterated, so every json, plist and tree dump left the field out, of the info and of its to_dict() export alike. - corekit.infoclass: _dump_excluded gives an Info's __excluded__ less each non-dunder key it renamed. to_dict() records that as the export's __excluded__, so an export dumps the field too. - dumpkit: excluded() takes _dump_excluded for an Info, so fields() and the nested-export branch of object_hook write the field under its own name. - An excluded name, a dunder key __excluded__ names, a dunder key iteration hides and a renamed dunder key stay out. - The dump resolves a deferred packet through indexing, once, as to_dict(), str and repr do; constructing, iterating and len() leave it deferred. - fields() writes a protocol object, such as that packet, as its info, as a frame's layers are written, at the top level and nested. Written by its attributes it carried its BytesIO's address, so a datagram dumped differently in each process. The new tests fail on ab7be2f; the protocol and fresh-process ones also fail on the first revision of this fix. dumpkit, corekit, foundation and project pass module by module. Closes #2733
Owner
Author
|
GOOD TO GO at
|
Contributor
|
Coverage: 94.45% (unit tier, Python 3.15,
Per-file detail: the |
4 tasks done
This branch has not been deployed
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 defectdumpkit dropped every
Infokey that had been renamed for clashing with a builtin name, such as a field nameditemsor a reassembled datagram'spacket.fields()checked__excluded__against the original name, andto_dict()carried the same list._dump_excluded, returns__excluded__minus the keys an instance renamed.to_dict()and dumpkit'sexcluded()both use it. Hidden dunders, excluded names and a renamed__doc__stay out. The helper costs nothing when anInforenamed nothing..info, the way frame layers already appear in dumps, so a resolvedpacketwrites UDP's or HTTP's fields and not the object's internals. Dumps stay deterministic: the same datagrams dumped in two fresh processes give identical JSON, plist and tree bytes, and a test pins that.packetis resolved once, when it is dumped. Building, iterating,len()andinleave it deferred.The extractor's own JSON, plist and tree outputs for the shipped captures are byte-identical to
main. The new tests fail onmain.Closes #2733