summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGlyph <glyph@twistedmatrix.com>2017-12-12 03:12:54 -0800
committerDaniele Varrazzo <daniele.varrazzo@gmail.com>2018-01-10 22:53:43 +0000
commit632cfe0617080c8c169d006482772b4dc1e2398f (patch)
tree05914a138d07122e30a6167193da4368a3100548
parentae227effe2bcc63cacbb2ee41a39345f0934e578 (diff)
downloadpsycopg2-632cfe0617080c8c169d006482772b4dc1e2398f.tar.gz
define a "polyfill" inline for python 2 compatibility
-rw-r--r--psycopg/adapter_datetime.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/psycopg/adapter_datetime.c b/psycopg/adapter_datetime.c
index a78311e..b5135ef 100644
--- a/psycopg/adapter_datetime.c
+++ b/psycopg/adapter_datetime.c
@@ -93,6 +93,12 @@ 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)
{