Fix for Python 3

Take into account that PyInt_CheckExact  does not exits in Python 3