[Python-Dev] Constants from C headers and int/long unification

Jack Jansen Jack.Jansen at cwi.nl
Fri Dec 5 18:17:15 EST 2003


The discussions on unification of int and long have now gone on for so 
many months that I no longer know how to handle them for the following 
scenario, please enlighten me.

I have C header files which I parse and to which I can do some simple 
processing before outputting them as Python code. An example C file 
will contain

enum {
    kConstantOne = 0xffffffff,
    kConstantTwo = -1,
};

Regexps will grab the two constants and output them to Python. The 
Python programmer will pass these constants to an API routine, at which 
point I need a PyArg_Parse format char that will convert both of these 
values to the 32 bit pattern 0xffffffff.

Question 1: Do I need to add anything to the constants before 
outputting them as Python code?
Question 2: Is there a format char that will convert both of the values 
produced by the answer to question 1 to the 32 bit pattern 0xffffffff?
--
Jack Jansen, <Jack.Jansen at cwi.nl>, http://www.cwi.nl/~jack
If I can't dance I don't want to be part of your revolution -- Emma 
Goldman




More information about the Python-Dev mailing list