Forget what I have written above. The entire type check is actually unneeded. Just check whether `PyLong_AsLong` reutrns -1. And if it does, return -1 as well.