[New-bugs-announce] [issue19272] Can't pickle lambda (while named functions are ok)

Facundo Batista report at bugs.python.org
Wed Oct 16 18:56:36 CEST 2013


New submission from Facundo Batista:

This is ok:

Python 3.4.0a3+ (default:86af5991c809, Oct 13 2013, 16:42:52) 
...
>>> import pickle
>>> def f():  
...   pass
... 
>>> pickle.dumps(f)
b'\x80\x03c__main__\nf\nq\x00.'


However, when trying to pickle a lambda, it fails:
>>>         
>>> pickle.dumps(lambda: None)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
_pickle.PicklingError: Can't pickle <class 'function'>: attribute lookup builtins.function failed


(Found this because I'm getting the same problem but when trying to use concurrent.futures.ProcessExecutor)

----------
components: Library (Lib)
messages: 200062
nosy: facundobatista
priority: normal
severity: normal
status: open
title: Can't pickle lambda (while named functions are ok)
type: behavior
versions: Python 3.3, Python 3.4

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue19272>
_______________________________________


More information about the New-bugs-announce mailing list