Fixes a couple of compilation warnings

Fixes two implicit conversion issues that were generating compilation
warnings: long to int, and Py_ssize_t (long) to int.