How to declare python ints in C extensions?

2009-01-04 Thread Tony Houghton
I want to write python wrappers for the Linux DVB API. The underlying structures and constants may change from time to time, and some of the constants are generated from macros, so I think it would be better to write the module in C rather than just copying the constants into pure python code and

Re: How to declare python ints in C extensions?

2009-01-04 Thread Saju Pillai
Tony Houghton wrote: I want to write python wrappers for the Linux DVB API. The underlying structures and constants may change from time to time, and some of the constants are generated from macros, so I think it would be better to write the module in C rather than just copying the constants

Re: How to declare python ints in C extensions?

2009-01-04 Thread Philip Semanchuk
On Jan 4, 2009, at 1:20 PM, Tony Houghton wrote: I want to write python wrappers for the Linux DVB API. The underlying structures and constants may change from time to time, and some of the constants are generated from macros, so I think it would be better to write the module in C rather than

Re: How to declare python ints in C extensions?

2009-01-04 Thread Christian Heimes
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. This trick makes it even easier: #ifndef

Re: How to declare python ints in C extensions?

2009-01-04 Thread Tony Houghton
On Sun, 04 Jan 2009 21:05:14 +0100 Christian Heimes li...@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