[Image-SIG] Bug in ImageWin (display.c)

Fredrik Lundh fredrik at pythonware.com
Thu Nov 13 11:40:14 CET 2008


Noboru Uchida wrote:

> Problem: Dib.draw() fails occasionally and raises Overflow Error.
> 
> Reason:
> In display.c, Window Handles(HWND) and Device Contexts(HDC) are both
> declared as "int".
> HWND/HDC arguments are parsed by PyArg_ParseTuple(), using format "i".
> 
> "i" converts Python integer to plain C integer, but when the value is
> greater than 0x7fffffff, it seems to fail in Overflow Error.
> 
> The problem is, HWND/HDC *can* take such values.
> 
> I think unsigned integer and Format "I" would fix this problem.

Thanks.

I suspect that this is a C API incompatibility introduced by the PEP 237 
activities back in 2.2 or 2.3 (the "I" formatting code was introduced in 
2.3), but it's definitely a bug.

</F>



More information about the Image-SIG mailing list