Repository navigation
test: release purged pcapkit generations in a long unittest leg (#2750) - #2752
Merged
Merged
Conversation
- typing caches every alias it subscribes, Protocol[...] at class creation and Optional[...] from get_type_hints on an Info annotation, and no purge cleared it. Each cached alias kept a purged generation reachable, and its saved excepthook another, so live generations, the heap and the cost of a negative Mapping subclass check grew from module to module. purge_modules and restore_modules now run typing._cleanups beside _reset_abc_caches; TypingCachesReleasedTests pins both and fails without the change. - PCAPNGTruncatedFileTests kept its sweep, whose failures hold their tracebacks and so the class's import, for the rest of the process. It is dropped by a class cleanup. `util/run_unittest_leg.py protocols --exclude protocols/internet`: peak RSS 1730 -> 1016 MiB, 1319 -> 828 s, 13 -> 5 live generations at the end; the touched modules and the tests/project guards pass under plain unittest.
Owner
Author
|
GOOD TO GO at
|
JarryShaw
added a commit
that referenced
this pull request
Nov 4, 2026
- Breaking: each protocol is a package of protocol, schema and data modules, the pcapkit.protocols.schema and .data trees and their aggregate exports removed with no alias, and a 1.5.x data model pickle fails to load (#2753), a new entry with the 1.5.1 imports and pickle measured. - 1.6.0's pcapkit.protocols role targets point at the package modules; the aggregator export claims of unreleased entries, the NoPayload and FrameRecord pickle claims and the TLSKeyLogEntries alias follow the layout. - CI: the LATEST tier's own job and the Coverage merge (#2754) and the ordering leg's halved rest of tests/protocols (21ec0a6, #2751), into the CI-legs entry; the package ruling into the conventions entry. - No entry for the test-only #2752. - The merge keeps #2483's class names in 1.5.0's conflicting roles under #2753's package paths. - CHANGELOG.md regenerated; util/changelog_md.py --check passes.
1 of 5 tasks
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?
test— tests onlyDescription of your pull request and other information
In a long plain-unittest leg, purged copies of
pcapkitstayed reachable and piled up: 13 live generations by the end ofprotocols (rest). Every negativeissubclass(C, Mapping)walks all of them, so modules ran slower the later they came.typing's subscription caches (Protocol[...],Optional[...]fromget_type_hints) held the purged classes.purge_modulesandrestore_modulesnow runtyping._cleanups, as CPython's own test runner does, and skip it where it is absent.PCAPNGTruncatedFileTests._sweptkept its failures' tracebacks for the rest of the process. A class cleanup now drops it.TypingCachesReleasedTestsfails without the_support.pychange.Same leg, base vs fixed: peak RSS 1730 → 1016 MiB, elapsed 1319 → 828 s, end-of-leg generations 13 → 5. Nothing in
pcapkit/changes.Closes #2750