Grant Edwards wrote: > I give up, how do I make this not fail under 2.4? > > fcntl.ioctl(self.dev.fileno(),0xc0047a80,struct.pack("HBB",0x1c,0x00,0x00)) > > I get an OverflowError: long int too large to convert to int > > ioctl() is expecting a 32-bit integer value, and 0xc0047a80 has > the high-order bit set. I'm assuming Python thinks it's a > signed value. How do I tell Python that 0xc0047a80 is an > unsigned 32-bit value? > Everyone seems to be suggesting that the fix for the problem is to somehow cobble together some way of forcing an unsigned integer into a signed integer (what you would do with a cast in C). However, if I understand the long<->int consolidation this is not consistent with that effort.
As far as I can tell, the underlying problem is that the C routine fcntl.ioctl is expecting a signed integer. These are the kinds of problems that need to be fixed. The function should be asking for an unsigned integer. This is possible with the C API at least since Python 2.3. Without these fixes, the long<->int consolidation is going to continue to produce frustration. There are many functions in the standard library that you would expect to take unsigned integers but actually specify signed integers. -- http://mail.python.org/mailman/listinfo/python-list