[Pyrex] pickling pyrex classes
    Greg Ewing 
    greg.ewing at canterbury.ac.nz
       
    Mon Mar 26 23:03:27 UTC 2007
    
    
  
Brian Blais wrote:
> Hello,
> 
> I have a class defined in Pyrex (to get speed increases), and python complains that 
> is can't be pickled (class def included below). ... I am not clear on which ones are
> causing the problem ...  I imagine it  might be the "double *"
It's not complaining about any particular features of the
class -- it simply has no idea at all how to pickle it,
because it's an extension type rather than a Python-defined
class.
The usual way of making an extension type pickleable is to
define a __reduce__ method, which "reduces" the object to
something Pickle knows how to handle. See the Python Library
Reference, section 3.14.5.2, "Pickling and unpickling extension
types".
--
Greg
    
    
More information about the Pyrex
mailing list