How to declare python ints in C extensions?
h at realh.co.uk
Mon Jan 5 00:47:29 CET 2009
On Sun, 04 Jan 2009 21:05:14 +0100
Christian Heimes <lists at cheimes.de> wrote:
> Philip Semanchuk schrieb:
> > This works for me:
> > PyModule_AddIntConstant(module, "O_CREAT", O_CREAT);
> > I've had to learn a lot about writing extensions from looking at the
> > Python source code. Lots of valuable tricks to be learned there.
Thanks, that's perfect. I see it is documented, but I didn't know where
> This trick makes it even easier:
> #ifndef PyModule_AddIntMacro
> #define PyModule_AddIntMacro(m, c) PyModule_AddIntConstant(m, #c, c)
Good idea, but I'm a lot more experienced with C in general than in
interfacing it with python, so I already thought of it :-).
TH * http://www.realh.co.uk
More information about the Python-list