changeset 1467:1fbd2ebdb978

cfield: Be compatible with Python < 2.6.
author Marcel Keller <mkeller@cs.au.dk>
date Wed, 08 Sep 2010 15:19:20 +0200
parents 9ee98fe5024c
children 361a7235b8a1
files viff/cfield.c
diffstat 1 files changed, 7 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/viff/cfield.c	Wed Aug 11 19:34:11 2010 +0200
+++ b/viff/cfield.c	Wed Sep 08 15:19:20 2010 +0200
@@ -24,6 +24,12 @@
 #include <gmp.h>
 #include <longintrepr.h>
 
+/* be compatible with Python < 2.6 */
+
+#ifndef Py_TYPE
+#define Py_TYPE(ob)             (((PyObject*)(ob))->ob_type)
+#endif
+
 // dummy type FieldElement
 static PyTypeObject cfield_FieldElementType = {
     PyObject_HEAD_INIT(NULL)
@@ -961,7 +967,7 @@
 
     if (PyDict_Contains(cfield_field_cache, modulus)) {
 	field = (cfield_GFType*)PyDict_GetItem(cfield_field_cache, modulus);
-	Py_INCREF(field);
+	Py_INCREF((PyObject*)field);
 	return (PyObject*)field;
     }