Repository navigation
fix(dumpkit): call super() without type(self) in make_dumper's object_hook (#2144) - #2146
Merged
Merged
Conversation
…_hook (#2144) In a subclass of the class make_dumper returns, type(self) is the subclass, so the fallback resolved back to the same object_hook and recursed until RecursionError. Zero-argument super() binds through the __class__ cell instead. Adds a test subclassing make_dumper's class for every output it is handed.
Owner
Author
|
GOOD TO GO at
|
4 of 5 tasks
Contributor
|
Coverage: 91.55% (unit tier, Python 3.15,
Per-file detail: the |
Owner
Author
|
Ready to merge at
This closes #2144. |
5 tasks done
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 defectDescription of your pull request and other information
Closes #2144.
make_dumper'sDictDumper.object_hookfallback callssuper().object_hook(o)instead ofsuper(type(self), self).object_hook(o), which recursed forever in any subclass.super(type(self), …)/super(self.__class__, …)exists inpcapkit/. The threesuper(<FixedClass>, self)calls (ininfoclass.py,fields/numbers.pyandschema/misc/pcapng.py) skip a class on purpose, and cannot recurse.tests/dumpkit/test_make_dumper_subclass_2144_unit.pycovers JSON, PLIST, Tree,PCAPIOandNotImplementedIO. For each, a subclass, a sub-subclass, and an override callingsuper()must all fall through. Without the fix, 15 fail withRecursionError. Thedumpkitordering leg gives 298 tests, 0 failures.