kalmen 0 Posted December 14, 2020 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
pyscripter 694 Posted December 14, 2020 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