fix inappropriate use of Py_ssize_t

Py_ssize_t != size_t, so casting void* to Py_ssize_t could result in OverflowErrors.

closes #533