From: Barry S. <ba...@ba...> - 2016-04-28 10:21:35
|
> On 28 Apr 2016, at 10:12, kishor sharma <kis...@gm...> wrote: > > >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? The module interface has changed a lot over time. No one noticed the need to have __module__ on the extension module. It is clearly not that important to python or we would have seen problems before now. If seem to be a low priority to fix if only pickle is affected and pickle is not useful to use with C++ extensions. You might like to add a bug report to tack this issue. If you have a patch to add __module__ I’ll review and add. Barry > > Thanks, > Kishor > ------------------------------------------------------------------------------ > Find and fix application performance issues faster with Applications Manager > Applications Manager provides deep performance insights into multiple tiers of > your business applications. It resolves application problems quickly and > reduces your MTTR. Get your free trial! > https://ad.doubleclick.net/ddm/clk/302982198;130105516;z_______________________________________________ > CXX-Users mailing list > CXX...@li... > https://lists.sourceforge.net/lists/listinfo/cxx-users |