Message205235
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 |
|
Date |
User |
Action |
Args |
2013-12-04 19:17:00 | pitrou | set | recipients:
+ pitrou, terry.reedy, ncoghlan, ezio.melotti, docs@python, westley.martinez, ChrisCooper, dstufft |
2013-12-04 19:17:00 | pitrou | set | messageid: <1386184620.19.0.893102247761.issue18840@psf.upfronthosting.co.za> |
2013-12-04 19:17:00 | pitrou | link | issue18840 messages |
2013-12-04 19:16:59 | pitrou | create | |
|