It's just my first PR to python - so I'm not really familiar with the code-base. I just did what I saw in other functions in the same file. But I'll update it - PySequence_Length/PyObject_Length look promising.