[C++-sig] Problem with custom lvalue converter

Tore Birkeland tore.birkeland at gmail.com
Wed Jul 19 15:11:54 CEST 2006


Hi

I'm using boost::python to create a wrapper for my quantum mechanics
propagator, and I've run into the following problem:

When i create a custom lvalue converter, and instance a new c++ class
from within the construct() method (as described in the FAQ), the
destructor for that object is called twice! Can someone tell me what I
am doing wrong, and how to avoid it?

I have attached c++ and .py files that reproduce the problem. When
destructorproblem.py is run, i get the following output:

> python destructorproblem.py
Constructing A
Got A
Destructing A
Destructing A

best regards,
Tore Birkeland
-------------- next part --------------
A non-text attachment was scrubbed...
Name: destructorproblem.cpp
Type: text/x-c++src
Size: 822 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20060719/2173f14a/attachment.cpp>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: destructorproblem.py
Type: application/octet-stream
Size: 109 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20060719/2173f14a/attachment.obj>


More information about the Cplusplus-sig mailing list