[PyKDE] ANN: PyQt v3.14, SIP v4.2, QScintilla v1.5 Released
Paul F. Kunz
Paul_Kunz at slac.stanford.edu
Sat Mar 12 07:19:59 GMT 2005
>>>>> On Fri, 11 Mar 2005 19:11:56 +0000, Phil Thompson <phil at riverbankcomputing.co.uk> said:
> 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?
It appears to be *this in the copy constructor.
>> 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.
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.
Ok, good tip to trace what is happening. I wouldn't get a chance
to try it until Sunday. I'm traveling today.
More information about the PyQt
mailing list