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

"Martin v. Löwis" martin at v.loewis.de
Sat Jul 19 15:51:21 CEST 2008


> 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.

Regards,
Martin


More information about the Python-3000 mailing list