[issue29187] Pickle failure is raising AttributeError and not PicklingError
Serhiy Storchaka
report at bugs.python.org
Sat Jan 7 02:15:10 EST 2017
Serhiy Storchaka added the comment:
Python implementation of pickle still raises PicklingError. Seems this was not intentional change.
>>> pickle._dumps(func()())
Traceback (most recent call last):
File "/home/serhiy/py/cpython/Lib/pickle.py", line 918, in save_global
obj2, parent = _getattribute(module, name)
File "/home/serhiy/py/cpython/Lib/pickle.py", line 266, in _getattribute
.format(name, obj))
AttributeError: Can't get local attribute 'func.<locals>.C' on <function func at 0xb7118d1c>
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/serhiy/py/cpython/Lib/pickle.py", line 1544, in _dumps
_Pickler(f, protocol, fix_imports=fix_imports).dump(obj)
File "/home/serhiy/py/cpython/Lib/pickle.py", line 409, in dump
self.save(obj)
File "/home/serhiy/py/cpython/Lib/pickle.py", line 521, in save
self.save_reduce(obj=obj, *rv)
File "/home/serhiy/py/cpython/Lib/pickle.py", line 605, in save_reduce
save(cls)
File "/home/serhiy/py/cpython/Lib/pickle.py", line 476, in save
f(self, obj) # Call unbound method with explicit self
File "/home/serhiy/py/cpython/Lib/pickle.py", line 978, in save_type
return self.save_global(obj)
File "/home/serhiy/py/cpython/Lib/pickle.py", line 922, in save_global
(obj, module_name, name))
_pickle.PicklingError: Can't pickle <class '__main__.func.<locals>.C'>: it's not found as __main__.func.<locals>.C
----------
components: +Extension Modules -Library (Lib)
nosy: +alexandre.vassalotti, serhiy.storchaka
stage: -> patch review
type: -> behavior
versions: +Python 3.7 -Python 3.4
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue29187>
_______________________________________
More information about the Python-bugs-list
mailing list