From 3fcb0351265e3077ee4088ba6e90016e5735a2a1 Mon Sep 17 00:00:00 2001 From: Glyph Date: Tue, 12 Dec 2017 03:12:54 -0800 Subject: [PATCH] define a "polyfill" inline for python 2 compatibility --- psycopg/adapter_datetime.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/psycopg/adapter_datetime.c b/psycopg/adapter_datetime.c index a78311ee..b5135efb 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) {