{"action":"closed","issue":{"url":"https://api.github.com/repos/uqfoundation/dill/issues/119","labels_url":"https://api.github.com/repos/uqfoundation/dill/issues/119/labels{/name}","comments_url":"https://api.github.com/repos/uqfoundation/dill/issues/119/comments","events_url":"https://api.github.com/repos/uqfoundation/dill/issues/119/events","html_url":"https://github.com/uqfoundation/dill/issues/119","id":98268373,"number":119,"title":"pickle of zip fails after pickle of weakref with recurse=True","user":{"login":"mmckerns","id":321534,"avatar_url":"https://avatars.githubusercontent.com/u/321534?v=3","gravatar_id":"","url":"https://api.github.com/users/mmckerns","html_url":"https://github.com/mmckerns","followers_url":"https://api.github.com/users/mmckerns/followers","following_url":"https://api.github.com/users/mmckerns/following{/other_user}","gists_url":"https://api.github.com/users/mmckerns/gists{/gist_id}","starred_url":"https://api.github.com/users/mmckerns/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mmckerns/subscriptions","organizations_url":"https://api.github.com/users/mmckerns/orgs","repos_url":"https://api.github.com/users/mmckerns/repos","events_url":"https://api.github.com/users/mmckerns/events{/privacy}","received_events_url":"https://api.github.com/users/mmckerns/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/uqfoundation/dill/labels/bug","name":"bug","color":"fc2929"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-07-30T21:23:50Z","updated_at":"2015-08-01T00:59:02Z","closed_at":"2015-08-01T00:59:02Z","body":"This is a very odd corner case… probably due to a reference to an inexact copy of weakref'ed object\r\n\r\n```\r\nPython 3.4.3 (default, May 25 2015, 18:57:37) \r\n[GCC 4.2.1 Compatible Apple LLVM 5.1 (clang-503.0.40)] on darwin\r\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.\r\n>>> import dill\r\n>>> dill.settings['recurse'] = True\r\n>>> z = zip('0','1')\r\n>>> dill.copy(z)\r\n<zip object at 0x108852d88>\r\n>>> \r\n>>> import weakref\r\n>>> y = weakref.WeakValueDictionary()\r\n>>> dill.copy(z)\r\n<zip object at 0x108852cc8>\r\n>>> x = weakref.WeakKeyDictionary()\r\n>>> dill.copy(z)\r\n<zip object at 0x108852c88>\r\n>>> dill.copy(y)\r\n<WeakValueDictionary at 4419886552>\r\n>>> dill.copy(z)\r\n(<class 'AttributeError'>, AttributeError(\"'module' object has no attribute 'iter'\",), <traceback object at 0x10884f188>)\r\n<function _get_attr at 0x107b48ae8> (<module 'weakref' from '/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/weakref.py'>, 'iter')\r\nTraceback (most recent call last):\r\n  File \"<stdin>\", line 1, in <module>\r\n  File \"/Users/mmckerns/lib/python3.4/site-packages/dill-0.2.4.dev0-py3.4.egg/dill/dill.py\", line 159, in copy\r\n    return loads(dumps(obj, *args, **kwds))\r\n  File \"/Users/mmckerns/lib/python3.4/site-packages/dill-0.2.4.dev0-py3.4.egg/dill/dill.py\", line 209, in loads\r\n    return load(file)\r\n  File \"/Users/mmckerns/lib/python3.4/site-packages/dill-0.2.4.dev0-py3.4.egg/dill/dill.py\", line 199, in load\r\n    obj = pik.load()\r\n  File \"/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/pickle.py\", line 1038, in load\r\n    dispatch[key[0]](self)\r\n  File \"/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/pickle.py\", line 1384, in load_reduce\r\n    value = func(*args)\r\n  File \"/Users/mmckerns/lib/python3.4/site-packages/dill-0.2.4.dev0-py3.4.egg/dill/dill.py\", line 661, in _get_attr\r\n    return getattr(self, name)\r\nAttributeError: 'module' object has no attribute 'iter'\r\n```\r\nor\r\n```\r\nPython 3.4.3 (default, May 25 2015, 18:57:37) \r\n[GCC 4.2.1 Compatible Apple LLVM 5.1 (clang-503.0.40)] on darwin\r\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.\r\n>>> import weakref\r\n>>> import dill\r\n>>> dill.settings['recurse'] = True\r\n>>> \r\n>>> z = zip('0','1')\r\n>>> dill.copy(z)\r\n<zip object at 0x10bf90d88>\r\n>>> x = weakref.WeakSet()          \r\n>>> dill.copy(z)\r\n<zip object at 0x10bf90e08>\r\n>>> dill.copy(x)\r\n<_weakrefset.WeakSet object at 0x10b0fc128>\r\n>>> dill.copy(z)\r\n(<class 'AttributeError'>, AttributeError(\"'module' object has no attribute 'iter'\",), <traceback object at 0x10bf80348>)\r\n<function _get_attr at 0x10b286ae8> (<module '_weakrefset' from '/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/_weakrefset.py'>, 'iter')\r\nTraceback (most recent call last):\r\n  File \"<stdin>\", line 1, in <module>\r\n  File \"/Users/mmckerns/lib/python3.4/site-packages/dill-0.2.4.dev0-py3.4.egg/dill/dill.py\", line 159, in copy\r\n    return loads(dumps(obj, *args, **kwds))\r\n  File \"/Users/mmckerns/lib/python3.4/site-packages/dill-0.2.4.dev0-py3.4.egg/dill/dill.py\", line 209, in loads\r\n    return load(file)\r\n  File \"/Users/mmckerns/lib/python3.4/site-packages/dill-0.2.4.dev0-py3.4.egg/dill/dill.py\", line 199, in load\r\n    obj = pik.load()\r\n  File \"/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/pickle.py\", line 1038, in load\r\n    dispatch[key[0]](self)\r\n  File \"/opt/local/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/pickle.py\", line 1384, in load_reduce\r\n    value = func(*args)\r\n  File \"/Users/mmckerns/lib/python3.4/site-packages/dill-0.2.4.dev0-py3.4.egg/dill/dill.py\", line 661, in _get_attr\r\n    return getattr(self, name)\r\nAttributeError: 'module' object has no attribute 'iter'\r\n```"}}