Hi, It appears that the utility function UintFromObj does not check if an error has occurred after calling PyInt_AsLong. If an error (namely an overflow error if the object is actually a long) occured, then it is silently ignored until the next call to PyErr_Occurred. In my case this propped up while working on an extension module that caught an OverflowError on a subsequent call.
If there is a specific reason for ignoring any errors (IntFromObj seems to explicitly clear any errors and return 0 instead), then I think the best thing would be to replace PyInt_AsLong with the macro PyInt_AS_LONG which does not do error checking and will not leave an exception hanging around. Thanks, - Devan. PS: I ran into this while trying using surface.convert(masks). Is there a better way to create the masks than x |= (1 << 0) | (1 << 1) | (1 << 2)... | (1 <<7) ?
