-
-
Notifications
You must be signed in to change notification settings - Fork 188
Closed
Labels
Milestone
Description
For python3.5 one test fails in test_classdef.py:
>>> from collections import namedtuple
>>> Z = namedtuple("Z", ['a','b'])
>>> Zi = Z(0,1)
>>> X = namedtuple("Y", ['a','b'])
>>> X.__name__ = "X"
>>> Xi = X(0,1)
>>> import dill
>>> assert Z == dill.copy(Z)
>>> assert Zi == dill.copy(Zi)
>>> dill.detect.errors(X)
PicklingError("Can't pickle <class '__main__.Y'>: it's not found as __main__.Y",)
>>> dill.detect.trace(True)
>>> assert X == dill.copy(X)
T6: <class '__main__.Y'>
Traceback (most recent call last):
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/pickle.py", line 268, in _getattribute
obj = getattr(obj, subpath)
AttributeError: module '__main__' has no attribute 'Y'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/pickle.py", line 907, in save_global
obj2, parent = _getattribute(module, name)
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/pickle.py", line 271, in _getattribute
.format(name, obj))
AttributeError: Can't get attribute 'Y' on <module '__main__' (<_frozen_importlib_external.SourceFileLoader object at 0x10b3910b8>)>
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/mmckerns/lib/python3.5/site-packages/dill-0.2.5.dev0-py3.5.egg/dill/dill.py", line 161, in copy
return loads(dumps(obj, *args, **kwds))
File "/Users/mmckerns/lib/python3.5/site-packages/dill-0.2.5.dev0-py3.5.egg/dill/dill.py", line 197, in dumps
dump(obj, file, protocol, byref, fmode, recurse)#, strictio)
File "/Users/mmckerns/lib/python3.5/site-packages/dill-0.2.5.dev0-py3.5.egg/dill/dill.py", line 190, in dump
pik.dump(obj)
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/pickle.py", line 408, in dump
self.save(obj)
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/pickle.py", line 475, in save
f(self, obj) # Call unbound method with explicit self
File "/Users/mmckerns/lib/python3.5/site-packages/dill-0.2.5.dev0-py3.5.egg/dill/dill.py", line 1133, in save_type
StockPickler.save_global(pickler, obj)
File "/opt/local/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/pickle.py", line 911, in save_global
(obj, module_name, name))
_pickle.PicklingError: Can't pickle <class '__main__.Y'>: it's not found as __main__.Y
>>> X.__name__ = "Y"
>>> Y = X
>>> assert Y == dill.copy(Y)
T6: <class '__main__.Y'>
# T6
>>>
Peque