Skip to content

fix(reassembly): Deferred cannot be pickled under protocol 0 or 1 #2423

Closed

Description

@JarryShaw

Describe the bug

Deferred (pcapkit/foundation/reassembly/data/data.py) declares __slots__ with no __getstate__/__setstate__, so it cannot be pickled under pickle protocols 0 or 1 at all — this is independent of the AppType/EnumRegistry pickle fix landing in #2421 and reproduces for any Deferred instance, including a bare Deferred(..., 42, b'x') holding a plain int.

To Reproduce

import pickle
from pcapkit.foundation.reassembly.data.data import Deferred
d = Deferred(lambda p, b: None, 42, b'x')
pickle.dumps(d, protocol=0)  # or protocol=1

Expected behavior

Either Deferred gets a __getstate__/__setstate__ pair compatible with __slots__ (the standard pattern), or the class documents that it requires protocol 2+ (Python's default since 3.0, so likely low real-world impact, but worth stating explicitly if not fixed).

Additional context

Found during review of #2421 (AppType reassembly ports). Protocols 2–5 work correctly. Scoped out of that PR since it's a pre-existing gap, not something #2421 introduced.

Activity

  1. added
    bugIssues reporting a defect (set by the bug report template; a default, not an assessment)
    pendingAccepted and unstarted - nobody is on it and nothing blocks it
    on Oct 29, 2026
  2. added this to the PyPCAPKit v1.5 milestone on Oct 29, 2026
  3. moved this to Pending in PyPCAPKiton Oct 29, 2026
  4. added
    wipWork in flight - a covering PR is open or an agent is actively on it
    and removed
    pendingAccepted and unstarted - nobody is on it and nothing blocks it
    on Oct 29, 2026
  5. moved this from Pending to WIP in PyPCAPKiton Oct 29, 2026
  6. removed
    wipWork in flight - a covering PR is open or an agent is actively on it
    on Oct 29, 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

    bugIssues reporting a defect (set by the bug report template; a default, not an assessment)

    Projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions