[New-bugs-announce] [issue30691] WeakSet is not pickleable

Serhiy Storchaka report at bugs.python.org
Sat Jun 17 14:54:10 EDT 2017


New submission from Serhiy Storchaka:

WeakSet contains the __reduce__ method, but it isn't pickleable (and never was), because the pickle state contains the value of the __dict__ dict attribute which contains a reference to unpickleable local function _remove().

>>> pickle.dumps(weakref.WeakSet())
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: Can't pickle local object 'WeakSet.__init__.<locals>._remove'

I wondering whether WeakSet should be made pickleable or the __reduce__ method should be removed. __reduce__() can be used also for copying, but  there are no tests for this feature.

----------
components: Library (Lib)
messages: 296243
nosy: georg.brandl, pitrou, rhettinger, serhiy.storchaka, twouters
priority: normal
severity: normal
status: open
title: WeakSet is not pickleable

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue30691>
_______________________________________


More information about the New-bugs-announce mailing list