[Python-3000] Int and Long unification (was Re: Help replacing Py_FindMethod)

Benjamin Peterson musiccomposition at gmail.com
Sat Jul 19 15:53:35 CEST 2008

On Sat, Jul 19, 2008 at 8:51 AM, "Martin v. Löwis" <martin at v.loewis.de> wrote:
>> Now I see another issue: I just changed "PyInt_*" in my code to
>> "PyLong_*" (since PyInt_* functions don't exist in Python 3.0). But
>> since an integer fails "PyLong_Check()" in Python 2.*, how can I check
>> for integers portably between Python 2.[3-6] and Python 3.0?. I would
>> like to avoid conditional compilation, if possible.
>>> I think PyNumber_Check should do the trick.
> PyNumber_Check also succeeds for floats, right? so it shouldn't be
> use when checking for integers is desired.

I believe he wants PyIndex_Check then.

> Regards,
> Martin

Benjamin Peterson
"There's no place like"

More information about the Python-3000 mailing list