{"action":"closed","issue":{"url":"https://api.github.com/repos/uqfoundation/dill/issues/243","repository_url":"https://api.github.com/repos/uqfoundation/dill","labels_url":"https://api.github.com/repos/uqfoundation/dill/issues/243/labels{/name}","comments_url":"https://api.github.com/repos/uqfoundation/dill/issues/243/comments","events_url":"https://api.github.com/repos/uqfoundation/dill/issues/243/events","html_url":"https://github.com/uqfoundation/dill/issues/243","id":270193292,"number":243,"title":"instance doesn't use pickled __class__ when same-named class exists","user":{"login":"piccolbo","id":905563,"avatar_url":"https://avatars3.githubusercontent.com/u/905563?v=4","gravatar_id":"","url":"https://api.github.com/users/piccolbo","html_url":"https://github.com/piccolbo","followers_url":"https://api.github.com/users/piccolbo/followers","following_url":"https://api.github.com/users/piccolbo/following{/other_user}","gists_url":"https://api.github.com/users/piccolbo/gists{/gist_id}","starred_url":"https://api.github.com/users/piccolbo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/piccolbo/subscriptions","organizations_url":"https://api.github.com/users/piccolbo/orgs","repos_url":"https://api.github.com/users/piccolbo/repos","events_url":"https://api.github.com/users/piccolbo/events{/privacy}","received_events_url":"https://api.github.com/users/piccolbo/received_events","type":"User","site_admin":false},"labels":[{"id":45530887,"url":"https://api.github.com/repos/uqfoundation/dill/labels/enhancement","name":"enhancement","color":"84b6eb","default":true}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":8,"created_at":"2017-11-01T04:52:54Z","updated_at":"2018-03-26T03:58:43Z","closed_at":"2018-03-26T03:58:43Z","author_association":"NONE","body":"I was just reading @mmckerns answer on [SO](https://stackoverflow.com/questions/25613543/how-to-use-dill-to-serialize-a-class-definition/25623532#25623532) and marveling at the power of Dill. So I tried his first example and to my surprise it fails exactly like pickle would, whereas @mmckerns states \"Pickle would blow up on the above.\" Which I think implies \"dill doesn't\". Then I found out that it fails in iPython but not python. Does anyone know what the cause is? Are there known limitations in using with iPython?\r\n\r\n```\r\nIn [59]: import dill\r\n    ...: \r\n    ...: class Foo(object):\r\n    ...:   def bar(self, x):\r\n    ...:     return x+self.y       \r\n    ...:   y = 1\r\n    ...: \r\n    ...: f = Foo()\r\n    ...: _Foo = dill.dumps(Foo)\r\n    ...: _f = dill.dumps(f)\r\n    ...: class Foo(object):\r\n    ...:   def bar(self, x):\r\n    ...:     return x*self.z  \r\n    ...:   z = -1\r\n    ...: f_ = dill.loads(_f)\r\n    ...: f_.y\r\n    ...: \r\n---------------------------------------------------------------------------\r\nAttributeError                            Traceback (most recent call last)\r\n<ipython-input-59-de94877455f9> in <module>()\r\n     14   z = -1\r\n     15 f_ = dill.loads(_f)\r\n---> 16 f_.y\r\n\r\nAttributeError: 'Foo' object has no attribute 'y'\r\n\r\n```\r\n\r\nI reported this on [SO](https://stackoverflow.com/questions/25613543/how-to-use-dill-to-serialize-a-class-definition/25623532#25623532) as a comment, then I thought that thread was a bit too past its prime for anyone to pay attention, so I am reporting here and cross linking."}}
{"actor":{"display_login":"mmckerns"}}