summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGlyph <glyph@twistedmatrix.com>2017-12-12 03:06:18 -0800
committerGlyph <glyph@twistedmatrix.com>2017-12-12 03:06:18 -0800
commit852884e086706625a69247f2ddafd1a1465b138c (patch)
treebd3b6d1a149ce8c3361d173231931021964c80ff
parent2cd9a78a97ee787517960ce6f066447e42ef8705 (diff)
downloadpsycopg2-852884e086706625a69247f2ddafd1a1465b138c.tar.gz
use accessor macros for pypy3 compatibility
-rw-r--r--psycopg/adapter_datetime.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/psycopg/adapter_datetime.c b/psycopg/adapter_datetime.c
index 9d04df4..a78311e 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 *