[PyKDE] ANN: PyQt v3.14, SIP v4.2, QScintilla v1.5 Released
Phil Thompson
phil at riverbankcomputing.co.uk
Fri Mar 11 19:11:56 GMT 2005
On Friday 11 March 2005 6:08 pm, Paul F. Kunz wrote:
> I ahve the following Python class defined...
>
> class Linear ( FunctionBase ) :
> def __init__ ( self, other = None ) :
> if other :
> FunctionBase.__init__( self, other )
> print "copy"
> self.initialize ()
> else:
> FunctionBase.__init__( self )
> print "default"
> self.initialize ()
>
> def clone ( self ) :
> print "clone"
> return Linear ( self )
>
>
> with some member functions not shown. The class FunctionBase is a C++
> abstract base class interfaced via FunctionBase.sip It appears that
> after clone() calls the copy constructor (speaking in C++ terms), the
> C++ object is deleted.
Which C++ object? The original, or the clone?
> How do I prevent that? Or am I trying to
> clone the function in an in correct way (I know C++ better than
> Python)?
Clone the function? I assume you mean clone the instance.
There is nothing obviously wrong with the Python. You can try building your
module with tracing enabled (sip -r) to see exactly when the C++ dtors are
being called.
Phil
More information about the PyQt
mailing list