From a81f12f9bd4d429fa73dd602d9fc1319a32a59a0 Mon Sep 17 00:00:00 2001 From: Daniele Varrazzo Date: Thu, 29 Dec 2016 21:43:04 +0100 Subject: [PATCH] Don't set tp_compare on Python 3 The slot is unused in Py < 3.5, and replaced by pg_as_async in Py 3.5. --- psycopg/typecast.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/psycopg/typecast.c b/psycopg/typecast.c index 1cae869f..e6e2faa9 100644 --- a/psycopg/typecast.c +++ b/psycopg/typecast.c @@ -491,7 +491,11 @@ PyTypeObject typecastType = { 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ +#if PY_VERSION_HEX < 0x03000000 typecast_cmp, /*tp_compare*/ +#else + 0, /*tp_reserved*/ +#endif typecast_repr, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/