From ae227effe2bcc63cacbb2ee41a39345f0934e578 Mon Sep 17 00:00:00 2001 From: Glyph Date: Tue, 12 Dec 2017 03:06:18 -0800 Subject: [PATCH] use accessor macros for pypy3 compatibility --- psycopg/adapter_datetime.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/psycopg/adapter_datetime.c b/psycopg/adapter_datetime.c index 9d04df40..a78311ee 100644 --- a/psycopg/adapter_datetime.c +++ b/psycopg/adapter_datetime.c @@ -100,7 +100,7 @@ _pydatetime_string_delta(pydatetimeObject *self) char buffer[8]; int i; - int a = obj->microseconds; + int a = PyDateTime_DELTA_GET_MICROSECONDS(obj); for (i=0; i < 6 ; i++) { buffer[5-i] = '0' + (a % 10); @@ -109,7 +109,9 @@ _pydatetime_string_delta(pydatetimeObject *self) buffer[6] = '\0'; return Bytes_FromFormat("'%d days %d.%s seconds'::interval", - obj->days, obj->seconds, buffer); + PyDateTime_DELTA_GET_DAYS(obj), + PyDateTime_DELTA_GET_SECONDS(obj), + buffer); } static PyObject *