Issue #25845: Merge PyLong_Check() cleanup from 3.5