From: kishor s. <kis...@gm...> - 2016-04-28 09:12:33
|
>Its been a long time since I used pickle. Personally I would avoid pickle because of the security and robustness issues. Anyway. It looks like if you want to pickle an extension object you have to implement the __reduce__ and/or __reduce_ex__ methods. You would have to see what pickle does with the tuple returned by __reduce__ to recreate the objects. You can also register functions to assist pickle. Given that the reason a C++ extension module is created is to wrap around complex resources I wonder if its reasonable to attempt to pickle a C++ object. Thanks Barry. If we leave pickling issue for a while, do you know why __module__ is not when we create the extension using PyCXX though we pass the module name using below example_module() : Py::ExtensionModule<example_module>( *"example"* ) Most of the python extension module have __module__ set which PyCXX extension doesn't. In [4]: cPickle.load.__module__ Out[4]: 'cPickle' Any thoughts? Thanks, Kishor |