Python/C API
Alex Martelli
aleaxit at yahoo.com
Thu Oct 5 05:31:47 EDT 2000
More information about the Python-list mailing list
Thu Oct 5 05:31:47 EDT 2000
- Previous message (by thread): Pmw: Slow Dialogs
- Next message (by thread): Python/C API
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
"Joerg Baumann" <joerg.baumann at stud.informatik.uni-erlangen.de> wrote in message news:39DC3EE1.A4568884 at stud.informatik.uni-erlangen.de... [snip] > I´m trying to extend python and I have following problem with the C/API: > Howto make a new instance of a class defined in Python from C? [snip] > I´m searching for somthing like > > PyObject* > f=PyInstace_New(PyString_FromString("foo"),PyString_FromString("data")) PyObject_CallObject (or PyObject_CallFunction) are what you need, see 6.1 in the API reference manual. But of course you need the object for the class, just as you need the PyObject* for any other Python object to do something with it! PyRun_String (see part 2 in the reference manual) may be a quick & dirty way to get it, but you still need the object pointers for the globals & locals dicts. Alex
- Previous message (by thread): Pmw: Slow Dialogs
- Next message (by thread): Python/C API
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list