Antoine Pitrou added the comment: Correction: you can't pickle executable code, you can pickle references to well-known objects (by name):
>>> def f(): pass ... >>> pickle.dumps(f) b'\x80\x03c__main__\nf\nq\x00.' >>> pickle.dumps(f.__code__) Traceback (most recent call last): File "<stdin>", line 1, in <module> _pickle.PicklingError: Can't pickle <class 'code'>: attribute lookup code on builtins failed ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue18840> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com