[New-bugs-announce] [issue9276] pickle should support methods

Jean-Paul Calderone report at bugs.python.org
Fri Jul 16 21:25:20 CEST 2010


New submission from Jean-Paul Calderone <exarkun at twistedmatrix.com>:

pickle doesn't support methods:


>>> class x:
...     def y(self):
...             pass
... 
>>> import pickle
>>> pickle.dumps(x.y)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/exarkun/Projects/python/branches/py3k/Lib/pickle.py", line 1314, in dumps
    Pickler(f, protocol, fix_imports=fix_imports).dump(obj)
_pickle.PicklingError: Can't pickle <class 'function'>: attribute lookup builtins.function failed

It would be easy to fix this, though.  Here's a link to some code that implements it: http://twistedmatrix.com/trac/browser/trunk/twisted/persisted/styles.py?rev=1

----------
components: Library (Lib)
messages: 110473
nosy: exarkun
priority: normal
severity: normal
status: open
title: pickle should support methods
type: feature request

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


More information about the New-bugs-announce mailing list