This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author serhiy.storchaka
Recipients georg.brandl, pitrou, rhettinger, serhiy.storchaka, twouters
Date 2017-06-18.05:58:42
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
The method is broken (and always was). Pickling doesn't work because the state contains unpickleable object. Copying works incorrectly, since the pickle state contains references to the original WeakSet and it overrides the __dict__ of the copy, making its state inconsistent. If the purpose of implementing the __reduce__ method was the support of the copying, the __reduce__ method should be fixed or the copying should be implemented with implementing the __copy__ and __deepcopy__ methods.

However there is a subtle moment with pickling WeakSet (as well as with pickling weakref.proxy, see issue18068). The problem is that if you pickled a WeakSet, but not hard references to its items, the items will be disappeared just after unpickling, since they have no hard references. This may confuse. If you pickle also hard refereces to the items, a WeakSet can be pickled and unpickled as expected (after fixing __reduce__).
Date User Action Args
2017-06-18 05:58:43serhiy.storchakasetrecipients: + serhiy.storchaka, twouters, georg.brandl, rhettinger, pitrou
2017-06-18 05:58:43serhiy.storchakasetmessageid: <>
2017-06-18 05:58:43serhiy.storchakalinkissue30691 messages
2017-06-18 05:58:42serhiy.storchakacreate