[Pyrex] unsigned integers bug

Josiah Carlson jcarlson at uci.edu
Wed Oct 19 21:44:52 CEST 2005


Rainer Deyke <rainerd at eldwood.com> wrote:
> I am trying to wrap a struct that contains a member of type 'unsigned'. 
>   When I try to assign a value of 0xff000000 to this member, I get a 
> Python exception: "OverflowError: long int too large to convert to int".
> 
> In trying to write a workaround, I discovered another bug: Pyrex doesn't 
> understand long literals.  A literal of 0x100000000 was clipped to 0 by 
> the C compiler, and a literal of 0x100000000 was rejected by Pyrex.

Try:
    0x100000000L
and/or:
    0xff000000UL

That works for me in both GCC and MSVC 6 (I think it is standard C
syntax for long integers).

 - Josiah




More information about the Pyrex mailing list