Jump to content
Sign in to follow this  
kalmen

when to use Py_XDecRef / Py_XIncRef ?

Recommended Posts

Hi,

I am trying to get info. when do I need to use Py_XDecRef / Py_XIncRef ?

 

i have a delphi object and i defined as follow,


pyObj  := PyDelphiWrapper.Wrap(  myDatamodule.tblCustomer );

PythonModule1.SetVar( 'TCustomer' , pyObj );

Py_XDecRef(pyObj) ? or Py_XIncRed(pyObj) ? 

 

 

any advice is much appreciated , thanks.

 

Share this post


Link to post

It depends on who is responsible for the destruction of this object.  If you call Py_XDecRef then when the last reference in the python code is deleted python the destructor of the object will be called.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×