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 <rep...@bugs.python.org> <http://bugs.python.org/issue30691> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com