BUG: fix buffer dtype mismatch on win-amd64

ValueError: Buffer dtype mismatch, expected 'Py_ssize_t' but got 'long'
(cherry picked from commit c1f3e25d4a3f58b7e43fcdc0f40cf4c1e8f735a2)