Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type's __dict__s are not pickled #42

Open
matsjoyce opened this issue May 28, 2014 · 1 comment
Open

Type's __dict__s are not pickled #42

matsjoyce opened this issue May 28, 2014 · 1 comment

Comments

@matsjoyce
Copy link
Contributor

Follow up for #41:

Python 3.4.1 (default, May 19 2014, 17:23:49) 
[GCC 4.9.0 20140507 (prerelease)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import abc, dill
>>> abc.ABCMeta.zzz=1
>>> dill.dump_session()
>>> 
================Restart================
Python 3.4.1 (default, May 19 2014, 17:23:49) 
[GCC 4.9.0 20140507 (prerelease)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import dill
>>> dill.load_session()
>>> abc.ABCMeta
<class 'abc.ABCMeta'>
>>> abc.ABCMeta.zzz
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: type object 'ABCMeta' has no attribute 'zzz'

This is due to https://github.com/uqfoundation/dill/blob/master/dill/dill.py#L808-L813 not adding the __dict__ attribute:

>>> dill.dill._trace(True)
>>> dill.dumps(abc.ABCMeta)
T4: <class 'abc.ABCMeta'>
b'\x80\x03cabc\nABCMeta\nq\x00.'
@mmckerns
Copy link
Member

mmckerns commented Jun 6, 2014

Also realized that dilldoesn't ever do anything specific for class instances, but it could. See new but not active code in 5f1774d.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants