summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniele Varrazzo <daniele.varrazzo@gmail.com>2018-01-10 22:24:05 +0000
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>2018-01-10 22:29:16 +0000
commit77c703395befce2cc87a18a5ec706f5500f04f04 (patch)
treefac0b923cd5c8c354ae0b8d79028cf5b3bff684c
parent3fcb0351265e3077ee4088ba6e90016e5735a2a1 (diff)
downloadpsycopg2-77c703395befce2cc87a18a5ec706f5500f04f04.tar.gz
Moved datatime compatibility macros with others
-rw-r--r--psycopg/adapter_datetime.c6
-rw-r--r--psycopg/python.h5
2 files changed, 5 insertions, 6 deletions
diff --git a/psycopg/adapter_datetime.c b/psycopg/adapter_datetime.c
index b5135ef..a78311e 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 fc8c2fe..fa894bf 100644
--- a/psycopg/python.h
+++ b/psycopg/python.h
@@ -87,6 +87,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
@@ -104,6 +105,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