[Python-Dev] Python reference count question

cedric paille cedric.dev at tele2.fr
Tue Feb 1 13:20:10 CET 2005

Hi all, i'm working on an app that embed python 2.3 with Gnu/Linux, and i'd like to have some precisions:

I'm making python's modules to extend my application's functions with a built in script editor.
At now all works very well, but i'd like to know if i'm not forgetting some references inc/dec....

Here is a portion of my code:

static PyObject *
Scene_GetNodeGraph(PyObject *self, PyObject *args)
  NodeGraph* Ng = NodeGraph::GetInstance();
  std::vector<String> NodG;
  PyObject* List = PyList_New(NodG.size());
  PyObject* Str = NULL;
  std::vector<String>::iterator it = NodG.begin();
  int i = 0;
  for (;it != NodG.end();it++)
    Str = PyString_FromString(it->AsChar());
  return List;

Can someone take a look at this and tell me if i must add some inc/decref ?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-dev/attachments/20050201/20c06f0b/attachment.html

More information about the Python-Dev mailing list