Skip to content

fix(reassembly): Deferred pickle format/subclass gaps left by #2424 #2425

Closed

Description

@JarryShaw

Describe the bug

Follow-ups surfaced during cross-review of PR #2424 (Deferred.__getstate__/__setstate__, fixing #2423). Neither is reachable in the repo today.

  1. Pickle format changed for protocols 2+, not just 0/1. The new __getstate__ returns a dict built from __slots__; the old slot-aware __reduce_ex__ path returned a different shape. A Deferred pickled by any released version (v1.5.0b1–b14) fails to load under fix(reassembly): make Deferred picklable under protocol 0 and 1 #2424's fix with AttributeError: 'tuple' object has no attribute 'items', and the reverse direction fails too.
  2. self.__slots__ is not MRO-aware. A hypothetical subclass of Deferred with its own __slots__, or one that adds a __dict__, would silently lose state under the new __getstate__/__setstate__ — the old __reduce_ex__ path handled both. No subclass exists in the repo currently.

Expected behavior

Either accept both the old (None, dict)-tuple shape and the new dict shape in __setstate__ (fixes 1), and make slot collection MRO-aware via itertools.chain.from_iterable(cls.__slots__ for cls in type(self).__mro__ if hasattr(cls, '__slots__')) (fixes 2) — or document that Deferred pickles are not stable across versions / across subclassing, if that's an acceptable limitation.

Additional context

Also flagged: the new test's docstring overclaims that a bound method is unpicklable under any protocol — IPv4.analyze pickles fine on 0–5. Worth a doc fix in whichever PR picks this up.

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
    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
  3. added this to the PyPCAPKit v1.5 milestone on Oct 29, 2026
  4. JarryShaw commented on Oct 29, 2026

    @JarryShaw
    OwnerAuthor

    Folding this into #2424 directly (same worker, same worktree, PR not yet merged) rather than a separate PR — cheaper than a fresh worker rediscovering Deferred from scratch. Will close via #2424's Closes #2425.

  5. 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