From 1477482e5982ec52ccf6a5e8f1e1836aea062452 Mon Sep 17 00:00:00 2001 From: Daniele Varrazzo Date: Wed, 10 Jan 2018 23:12:01 +0000 Subject: [PATCH] Fixed pydatetime macros for Python 3.2 --- psycopg/python.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/psycopg/python.h b/psycopg/python.h index 1358ef74..ce8516d8 100644 --- a/psycopg/python.h +++ b/psycopg/python.h @@ -111,10 +111,6 @@ 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 @@ -133,6 +129,12 @@ typedef unsigned long Py_uhash_t; #endif +#ifndef PyDateTime_DELTA_GET_DAYS +#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) +#endif + HIDDEN PyObject *Bytes_Format(PyObject *format, PyObject *args); /* Mangle the module name into the name of the module init function */