`PyInt_AS_LONG` would be fine here after `PyInt_CheckExact` and should be a bit faster, but if there is noticeable difference in timings then it doesn't matter. Other overhead may dominate.