Avoid overflow error for large int on 64-bit

When passing large integer to some method (e.g. size=10*1000*1000*1000) I get an exception:
OverflowError: bad numeric conversion: positive overflow

The error caused by conversion long to sint32 value. Python's int is long in C and has 64-bit width on 64-bit platform, so it can't be converted to int32.