get class instance from C++ extension?

Martin von Loewis loewis at informatik.hu-berlin.de
Mon Jun 18 06:55:10 EDT 2001


"Toshiya Kawakami" <kawakami at lead.dion.ne.jp> writes:

> 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()?

Please have a look at Objects/readline.c. There, you have

on_completion(char *text, int state)

which ought to call a completion function. It does so by writing

	r = PyObject_CallFunction(completer, "si", text, state);
	if (r == NULL)
		goto error;

The "s" means that the first argument to the completer is a string,
and the "i" means the second argument is an integer.

Regards,
Martin



More information about the Python-list mailing list