You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(reassembly): Deferred pickle format/subclass gaps left by #2424 #2425
Follow-ups surfaced during cross-review of PR #2424 (Deferred.__getstate__/__setstate__, fixing #2423). Neither is reachable in the repo today.
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.
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.
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.
Activity
JarryShaw commentedon Oct 29, 2026
Folding this into #2424 directly (same worker, same worktree, PR not yet merged) rather than a separate PR — cheaper than a fresh worker rediscovering
Deferredfrom scratch. Will close via #2424'sCloses #2425.fix(reassembly): make Deferred picklable under protocol 0 and 1 (#2423)
fix(reassembly): make Deferred picklable under protocol 0 and 1 (#2423)
fix(reassembly): bypass copyreg's MRO walk for Deferred's protocol<2 …
fix(reassembly): bypass copyreg's MRO walk for Deferred's protocol<2 …
fix(reassembly): bypass copyreg's MRO walk for Deferred's protocol<2 …
fix(reassembly): bypass copyreg's MRO walk for Deferred's protocol<2 …