fix inappropriate use of Py_ssize_t

`Py_ssize_t != size_t`, so casting `void*` to `Py_ssize_t` could result in OverflowErrors due to negative pointers.

closes #533