[C++-sig] copy.deepcopy of a vector, and the resulting error

Matthew Scouten matthew.scouten at gmail.com
Thu Feb 7 20:23:54 CET 2008


Some Questions:
This Indexing Suite 2: What is it and how do I use that instead of the
normal indexing suite? even better error msgs will help.
The pickle protocol method looks like too much work, given that some of
these objects have dozens of data members that need to be copied.
Implementing an explicit __deepcopy__ for every class could be a lot of work
, and I do not understand what that memo argument is doing.
I had hoped that BP would just know what to do. After all, all the classes
in question have perfectly good copy ctors. I take it that
'class_<...>.enable_copy()' and the other ideas in that thread were never
implemented?


On Feb 6, 2008 2:44 AM, Hans Meine <meine at informatik.uni-hamburg.de> wrote:

> Am Mittwoch, 06. Februar 2008 08:42:43 schrieb Roman Yakovenko:
> > 2008/2/5 Matthew Scouten <matthew.scouten at gmail.com>:
> > > So I have a vector of foo that I exposed with the indexing suite, and
> I
> > > need to deepcopy it. I get a Boost.Python.ArgumentError exception when
> I
> > > try to iterate across the result later.
> >
> > I tried your example using indexing suite 2 and it gave me nice & very
> > helpful error message:
> >
> > RuntimeError: Pickling of "deepcopy.items_t" instances is not enabled
> > (http://www.boost.org/libs/python/doc/v2/pickle.html)
> >
> > Take a look on the URL.
>
> Also have a look in the archives for the "How about
> class_<...>.enable_copy() ?" thread, if you want explicit __deepcopy__
> instead of using the pickle protocol.
>
> --
> Ciao, /  /
>     /--/
>    /  / ANS
> _______________________________________________
> C++-sig mailing list
> C++-sig at python.org
> http://mail.python.org/mailman/listinfo/c++-sig
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20080207/1922d2df/attachment.htm>


More information about the Cplusplus-sig mailing list