[Python-Dev] PyObject_CallFunction and 'N' format char

Gustavo Carneiro gjcarneiro at gmail.com
Sun Jun 25 02:09:09 CEST 2006


  Sorry this is slightly offtopic, but I think it's important...

  According to recent experiments tracking down a memory leak, it
seems that PyObject_CallFunction(func, "N", object) and
PyObject_CallFunction(func, "O", object) are doing exactly the same
thing.  However, documentation says "The C arguments are described
using a   Py_BuildValue() style format string.".  And of course
Py_BuildValue consumes one object reference, according to the
documentation and practice.  However, PyObject_CallFunction does _not_
consume such an object reference, contrary to what I believed for
years.  God knows how many leaks I may have introduced in my
bindings... :|

  Any comments?


More information about the Python-Dev mailing list