Repository navigation
fix(registry): unregistering a custom protocol removes its name from __proto__ (#1505) - #1530
Merged
Merged
Conversation
Owner
Author
|
Verdict: NEEDS CHANGES at Confirmed:
Blocking: a lease cycle leaks the custom name, a regression from
When two leases displace each other, Should fix:
|
Contributor
|
Coverage: 90.09% (unit tier, Python 3.14,
Per-file detail: the |
Merged
2 of 13 tasks
…__proto__ (#1505) - The nine code registrars (register_linktype, register_pcap, register_pcapng, register_ethertype, register_transtype, register_apptype, register_tcp, register_udp, register_sctp) end in a new _register_name: register_protocol, plus a lease on the by-name entry when the write changed it, recording what it displaced and which (destination, code) pairs still hold it. - Leases stack per name, one per write, so a class can hold two (a built-in retaking its name from a custom shadow). Releasing the top one restores what it displaced; releasing a buried one hands that to the lease above. A name held before the registration is never leased, so no restore removes it. - The lease tables are guarded by a module RLock. - Delete the Gap(1505) rows; add test_registry_name_restore_unit.py, with a seeded fuzz checked after every call.
JarryShaw
force-pushed
the
fix/1505-registry-name-leak
branch
from
October 9, 2026 23:21
5c16f4f to
87dae59
Compare
Owner
Author
|
Verdict: GOOD TO GO at
Non-blocking:
|
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 changeAdded 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 elseDescription of your pull request and other information
All nine code registrars end in
register_protocol(module)(protocols.py:235). Nothing undid that write, so registering a code back restored the code but left the name._register_name(module, *(destination, code)). When the write changes a name, it pushes a lease onto that name's stack, recording what it displaced and which codes hold it.register_linktypeandregister_apptypehold the name from every destination they write.RLock, not.pop(key, None): a lock keeps the stack consistent as well as avoidingKeyError.Gap(1505)rows are deleted.test_registry_name_restore_unit.pyis new: 6 of its 8 tests fail onmain, and 2 fail on5c16f4f47(the cycle test and the fuzz).main, 96/2000 on5c16f4f47and 0 on this head. 30000 more sequences on 3 other seeds also come back clean.foundation.pyhas no sibling: none of its registrars writes a second registry. fix(protocols): restoring a protocol registration puts back the class, not the shipped ModuleDescriptor #1504's sites are untouched.Ran one at a time, on
81efa6035:tests/foundation/registry,tests/protocols/test_dispatch_registry_unit.py,tests/project,tests/test_docstring_contract.py,tests/test_tier_guard.py, all green. mypy and pylint report nothing new onprotocols.py.Closes #1505