diff --git a/psycopg/adapter_datetime.c b/psycopg/adapter_datetime.c index b5135efb..a78311ee 100644 --- a/psycopg/adapter_datetime.c +++ b/psycopg/adapter_datetime.c @@ -93,12 +93,6 @@ error: return rv; } -#ifndef PyDateTime_DELTA_GET_DAYS -#define PyDateTime_DELTA_GET_DAYS(o) (o->days) -#define PyDateTime_DELTA_GET_SECONDS(o) (o->seconds) -#define PyDateTime_DELTA_GET_MICROSECONDS(o) (o->microseconds) -#endif - static PyObject * _pydatetime_string_delta(pydatetimeObject *self) { diff --git a/psycopg/python.h b/psycopg/python.h index cfb8dad3..1358ef74 100644 --- a/psycopg/python.h +++ b/psycopg/python.h @@ -93,6 +93,7 @@ typedef unsigned long Py_uhash_t; #ifndef PyNumber_Int #define PyNumber_Int PyNumber_Long #endif + #endif /* PY_MAJOR_VERSION > 2 */ #if PY_MAJOR_VERSION < 3 @@ -110,6 +111,10 @@ typedef unsigned long Py_uhash_t; #define Bytes_ConcatAndDel PyString_ConcatAndDel #define _Bytes_Resize _PyString_Resize +#define PyDateTime_DELTA_GET_DAYS(o) (((PyDateTime_Delta*)o)->days) +#define PyDateTime_DELTA_GET_SECONDS(o) (((PyDateTime_Delta*)o)->seconds) +#define PyDateTime_DELTA_GET_MICROSECONDS(o) (((PyDateTime_Delta*)o)->microseconds) + #else #define Bytes_Type PyBytes_Type