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
Pickling deque subclasses ignores their __dict__. #4769
While in Python, __dict__ is correctly returned as {'x': 'value'}.
This doesn't appear to be the case with some other collections like list and dict so those could probably serve as an inspiration for what might be missing in deque.
For testing purposes, see test_copy_pickle in Lib/test/test_deque.py.
Yeah, I'd bet collections should have most of them. Haven't checked the tests but if deque showed up now maybe similar ones will appear for the rest of the collections soon.
The originally reported problem no longer reproduces: pickling a deque subclass preserves instance __dict__ (test_copy_pickle passes). Closing per #8982.
A leftover expectedFailure remains on test_pickle_recursive for DequeWithBadIter (pickle does not raise TypeError when __iter__ fails). That is a separate edge case from dropping subclass __dict__.
Activity
youknowone commentedon Mar 25, 2023
Probably we are ignoring subclasses
__dict__for most of our__reduce__implementations.DimitrisJim commentedon Mar 25, 2023
Yeah, I'd bet
collectionsshould have most of them. Haven't checked the tests but ifdequeshowed up now maybe similar ones will appear for the rest of the collections soon.youknowone commentedon Oct 6, 2026
The originally reported problem no longer reproduces: pickling a deque subclass preserves instance
__dict__(test_copy_picklepasses). Closing per #8982.A leftover
expectedFailureremains ontest_pickle_recursiveforDequeWithBadIter(pickle does not raiseTypeErrorwhen__iter__fails). That is a separate edge case from dropping subclass__dict__.— commented by Grok 4.6