Interesting. How many of those casts are actually necessary to make
things work? Have you figured out more precisely why this is failing?
E.g., is it somehow that LONG_MIN ends up being an unsigned constant?
It seems to me that a better fix would be to fix LONG_MIN and LONG_MAX
somewhere in the configuration files; there are bound to be more uses of
LONG_MIN and LONG_MAX in the source that are going to cause problems.
P.S. Looking at your python-dev messages, does len([1, 2]) really return
1L? Not 2L?