chiark / gitweb /
More fixing for modern Pythons. No longer works with 2.2. Sorry.
[catacomb-python] / field.c
diff --git a/field.c b/field.c
index ea7d6dee00fac6167de80b3e5b4a52271d530df2..89fe8fbf2e26e01951542553f3f66bb955bb4571 100644 (file)
--- a/field.c
+++ b/field.c
@@ -56,20 +56,19 @@ static PyObject *fe_pynew(PyTypeObject *ty, PyObject *arg, PyObject *kw)
 
 static PyObject *field_dopywrap(PyTypeObject *ty, field *f)
 {
-  field_pyobj *fobj = newtype(ty, 0);
+  field_pyobj *fobj = newtype(ty, 0, f->ops->name);
   fobj->f = f;
-  fobj->ty.tp_name = (/*unconst*/ char *)f->ops->name;
-  fobj->ty.tp_basicsize = sizeof(fe_pyobj);
-  fobj->ty.tp_base = fe_pytype;
+  fobj->ty.type.tp_basicsize = sizeof(fe_pyobj);
+  fobj->ty.type.tp_base = fe_pytype;
   Py_INCREF(fe_pytype);
-  fobj->ty.tp_flags = (Py_TPFLAGS_DEFAULT |
-                      Py_TPFLAGS_BASETYPE |
-                      Py_TPFLAGS_CHECKTYPES |
-                      Py_TPFLAGS_HEAPTYPE);
-  fobj->ty.tp_alloc = PyType_GenericAlloc;
-  fobj->ty.tp_free = _PyObject_Del;
-  fobj->ty.tp_new = fe_pynew;
-  PyType_Ready(&fobj->ty);
+  fobj->ty.type.tp_flags = (Py_TPFLAGS_DEFAULT |
+                           Py_TPFLAGS_BASETYPE |
+                           Py_TPFLAGS_CHECKTYPES |
+                           Py_TPFLAGS_HEAPTYPE);
+  fobj->ty.type.tp_alloc = PyType_GenericAlloc;
+  fobj->ty.type.tp_free = 0;
+  fobj->ty.type.tp_new = fe_pynew;
+  PyType_Ready(&fobj->ty.type);
   return ((PyObject *)fobj);
 }
 
@@ -293,7 +292,7 @@ static void fe_pydealloc(PyObject *me)
 {
   Py_DECREF(FE_FOBJ(me));
   MP_DROP(FE_X(me));
-  PyObject_DEL(me);
+  FREEOBJ(me);
 }
 
 #define UNOP(name, check)                                              \
@@ -452,7 +451,7 @@ static PyTypeObject fe_pytype_skel = {
   0,                                   /* @tp_init@ */
   PyType_GenericAlloc,                 /* @tp_alloc@ */
   abstract_pynew,                      /* @tp_new@ */
-  _PyObject_Del,                       /* @tp_free@ */
+  0,                                   /* @tp_free@ */
   0                                    /* @tp_is_gc@ */
 };
 
@@ -581,7 +580,7 @@ static PyTypeObject field_pytype_skel = {
   0,                                   /* @tp_init@ */
   PyType_GenericAlloc,                 /* @tp_alloc@ */
   abstract_pynew,                      /* @tp_new@ */
-  _PyObject_Del,                       /* @tp_free@ */
+  0,                                   /* @tp_free@ */
   0                                    /* @tp_is_gc@ */
 };
 
@@ -659,7 +658,7 @@ static PyTypeObject primefield_pytype_skel = {
   0,                                   /* @tp_init@ */
   PyType_GenericAlloc,                 /* @tp_alloc@ */
   primefield_pynew,                    /* @tp_new@ */
-  _PyObject_Del,                       /* @tp_free@ */
+  0,                                   /* @tp_free@ */
   0                                    /* @tp_is_gc@ */
 };
 
@@ -726,7 +725,7 @@ static PyTypeObject niceprimefield_pytype_skel = {
   0,                                   /* @tp_init@ */
   PyType_GenericAlloc,                 /* @tp_alloc@ */
   niceprimefield_pynew,                        /* @tp_new@ */
-  _PyObject_Del,                       /* @tp_free@ */
+  0,                                   /* @tp_free@ */
   0                                    /* @tp_is_gc@ */
 };
 
@@ -786,7 +785,7 @@ static PyTypeObject binfield_pytype_skel = {
   0,                                   /* @tp_init@ */
   PyType_GenericAlloc,                 /* @tp_alloc@ */
   abstract_pynew,                      /* @tp_new@ */
-  _PyObject_Del,                       /* @tp_free@ */
+  0,                                   /* @tp_free@ */
   0                                    /* @tp_is_gc@ */
 };
 
@@ -859,7 +858,7 @@ static PyTypeObject binpolyfield_pytype_skel = {
   0,                                   /* @tp_init@ */
   PyType_GenericAlloc,                 /* @tp_alloc@ */
   binpolyfield_pynew,                  /* @tp_new@ */
-  _PyObject_Del,                       /* @tp_free@ */
+  0,                                   /* @tp_free@ */
   0                                    /* @tp_is_gc@ */
 };
 
@@ -941,7 +940,7 @@ static PyTypeObject binnormfield_pytype_skel = {
   0,                                   /* @tp_init@ */
   PyType_GenericAlloc,                 /* @tp_alloc@ */
   binnormfield_pynew,                  /* @tp_new@ */
-  _PyObject_Del,                       /* @tp_free@ */
+  0,                                   /* @tp_free@ */
   0                                    /* @tp_is_gc@ */
 };