Skip to content

fix(corekit): a non-final Info subclass built after its parent leaks internal keys from to_dict() #1490

Closed

Description

@JarryShaw

Describe the bug
Once a non-final Info parent has been instantiated, its non-final children are never finalised. Their to_dict(), len() and iteration then include internal names.

Reproduction

from pcapkit.corekit.infoclass import Info
class Parent(Info): a: 'int'
class Child(Parent): b: 'int'
Parent.from_dict({'a': 1})
list(Child.from_dict({'a': 1, 'b': 2}).to_dict())   # ['__map__', '__map_reverse__', '__multi__', 'a', 'b']

Expected behavior
['a', 'b'], whichever class was built first.

System information
Linux, CPython 3.14.7, main at 00d232890.

Additional context
Info.__new__ finalises automatically only while __finalised__ reads NONE (pcapkit/corekit/infoclass.py:435). The child instead inherits the parent's BASE (:223), and keeps the __excluded__ it copied at class creation, without the names info_final adds (:146). This affects these real models when an intermediate one is built first:

  • hopopt/ipv6_opts QuickStartOption and SMFDPDOption;
  • ipv4.QSOption;
  • tcp.MPTCPJoin.

Found by the #1202 corekit round-trip slice.

Activity

  1. added
    fixPull requests that fix a defect (fix: subject prefix)
    pendingAccepted and unstarted - nobody is on it and nothing blocks it
    on Oct 9, 2026
  2. JarryShaw commented on Oct 9, 2026

    @JarryShaw
    OwnerAuthor

    Blocked until #1492 merges. #1492 adds the Gap row for this defect to tests/corekit/_roundtrip.py, and the fix must delete that row in the same PR.

  3. added
    blockedDeferred pending another issue or decision; see the last comment for what unblocks it
    and removed
    pendingAccepted and unstarted - nobody is on it and nothing blocks it
    on Oct 9, 2026
  4. JarryShaw commented on Oct 9, 2026

    @JarryShaw
    OwnerAuthor

    Unblocked: #1492 merged (d9e12e82e). A worker is starting on this against current main; the fix PR deletes this defect's Gap row.

  5. added
    wipWork in flight - a covering PR is open or an agent is actively on it
    and removed
    blockedDeferred pending another issue or decision; see the last comment for what unblocks it
    on Oct 9, 2026
  6. moved this from Blocked to WIP in PyPCAPKiton Oct 9, 2026
  7. removed
    wipWork in flight - a covering PR is open or an agent is actively on it
    on Oct 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    fixPull requests that fix a defect (fix: subject prefix)

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions