get class instance from C++ extension?

Toshiya Kawakami kawakami at lead.dion.ne.jp
Mon Jun 18 02:55:03 EDT 2001


"Martin von Loewis" <loewis at informatik.hu-berlin.de> wrote in message
news:j48zisi8m9.fsf at informatik.hu-berlin.de...
> First of all, you should stop using Py_BuildValue in cases like this;
> this example would better use PyInt_FromLong.
>
> In general, you do Python things in C the same way as in Python. To
> create an instance of c1, you need to *call* c1. So your code should
> read
>
> c1 = ... // lookup c1
> x = PyObject_CallFunction(c1, "()");

Thank you for replying.

I read the spec of PyObject_CallFunction() in "Python/C API
Reference Manual", but cannot understand how to use it.
Is there any simple example for PyObject_CallFunction()?






More information about the Python-list mailing list