diff --git a/psycopg/adapter_pint.c b/psycopg/adapter_pint.c index b7128546..950b6557 100644 --- a/psycopg/adapter_pint.c +++ b/psycopg/adapter_pint.c @@ -40,7 +40,7 @@ pint_getquoted(pintObject *self, PyObject *args) /* Convert subclass to int to handle IntEnum and other subclasses * whose str() is not the number. */ if (PyLong_CheckExact(self->wrapped) -#if PY_MAJOR_VERSION < 2 +#if PY_2 || PyInt_CheckExact(self->wrapped) #endif ) {