Python/C API

Joerg Baumann joerg.baumann at stud.informatik.uni-erlangen.de
Thu Oct 5 14:35:31 EDT 2000


Thank you for your hints.
This workes for me:

      a=PyImport_AddModule("xyz");
      b=PyModule_GetDict(a);
      // no Py_DECREF(a)
      a=PyDict_GetItemString(b,"foo");
      // no Py_DECREF(b)
      b=Py_BuildValue("(s)",_ptemp);
      c=PyObject_CallObject(a, b);
      Py_DECREF(b);
      // c holds xyz.foo("test") with refcount 1

bye
   joerg




More information about the Python-list mailing list