Older versions of Python return a SystemError when a non-int is passed to
PyLong_ASLong(). Switch it to a TypeError for consistency with later versions
and common sense.