aliles / funcsigs

Python function signatures package for Python 2.6, 2.7 and 3.2+
http://pypi.python.org/pypi/funcsigs
Other
48 stars 33 forks source link

pickle support ? #19

Open asmodehn opened 8 years ago

asmodehn commented 8 years ago

Basically trying to pickle a signature pickle.dumps(signature(my_func)) leads to :

File "/usr/lib/python2.7/pickle.py", line 1374, in dumps
    Pickler(file, protocol).dump(obj)
  File "/usr/lib/python2.7/pickle.py", line 224, in dump
    self.save(obj)
  File "/usr/lib/python2.7/pickle.py", line 306, in save
    rv = reduce(self.proto)
  File "/usr/lib/python2.7/copy_reg.py", line 77, in _reduce_ex
    raise TypeError("a class that defines __slots__ without "
TypeError: a class that defines __slots__ without defining __getstate__ cannot be pickled

It would be useful to be able to serialize function signatures. Although I don't know what python 3.X does about this and if this is in the scope of funcsigs to implement this...