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

"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 "PyLongCheck()" 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 PyNumberCheck 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