tag 468999 patch pending
severity 468999 serious
thanks

Hi Matthias,

the bug exists, attached is a patch that removes the crashing, observable e.g. with /usr/share/doc/python-netcdf/examples/netcdf_demo.py. I have also fixed the PyMem_DEL bugs in the Scientific_mpi extension but as mpipython continues to be based on python2.4, this is not a crasher (yet?). It will be uploaded during the BSP next weekend or earlier with your OK.

Kind regards

T.
--
Thomas Viehmann, http://thomas.viehmann.net/
diff -u python-scientific-2.4.11/debian/changelog python-scientific-2.4.11/debian/changelog
--- python-scientific-2.4.11/debian/changelog
+++ python-scientific-2.4.11/debian/changelog
@@ -1,3 +1,11 @@
+python-scientific (2.4.11-1.2) unstable; urgency=low
+
+  * Non-maintainer upload.
+  * Fix use of Python API memory handling functions.
+    Closes: #468999
+
+ -- Thomas Viehmann <[EMAIL PROTECTED]>  Wed, 05 Mar 2008 18:29:30 +0100
+
 python-scientific (2.4.11-1.1) unstable; urgency=low
 
   * Non-maintainer upload.
only in patch2:
unchanged:
--- python-scientific-2.4.11.orig/Src/Scientific_netcdf.c
+++ python-scientific-2.4.11/Src/Scientific_netcdf.c
@@ -547,7 +547,7 @@
   Py_XDECREF(self->attributes);
   Py_XDECREF(self->name);
   Py_XDECREF(self->mode);
-  PyMem_DEL(self);
+  PyObject_Del(self);
 }
 
 /* Create file object */
@@ -555,7 +555,7 @@
 static PyNetCDFFileObject *
 PyNetCDFFile_Open(char *filename, char *mode)
 {
-  PyNetCDFFileObject *self = PyObject_NEW(PyNetCDFFileObject,
+  PyNetCDFFileObject *self = PyObject_New(PyNetCDFFileObject,
 					  &PyNetCDFFile_Type);
   int rw, share, ret;
   if (self == NULL)
@@ -1142,7 +1142,7 @@
     free(self->name);
   Py_XDECREF(self->file);
   Py_XDECREF(self->attributes);
-  PyMem_DEL(self);
+  PyObject_Del(self);
 }
 
 /* Create variable object */
@@ -1155,7 +1155,7 @@
   int recdim;
   int i;
   if (check_if_open(file, -1)) {
-    self = PyObject_NEW(PyNetCDFVariableObject, &PyNetCDFVariable_Type);
+    self = PyObject_New(PyNetCDFVariableObject, &PyNetCDFVariable_Type);
     if (self == NULL)
       return NULL;
     self->file = file;
only in patch2:
unchanged:
--- python-scientific-2.4.11.orig/Src/MPI/Scientific_mpi.c
+++ python-scientific-2.4.11/Src/MPI/Scientific_mpi.c
@@ -101,7 +101,7 @@
 {
   PyMPIOperationObject *self;
 
-  self = PyObject_NEW(PyMPIOperationObject, &PyMPIOperation_Type);
+  self = PyObject_New(PyMPIOperationObject, &PyMPIOperation_Type);
   if (self == NULL)
     return NULL;
   self->mpi_op = mpi_op;
@@ -113,7 +113,7 @@
 static void
 PyMPIOperation_dealloc(PyMPIOperationObject *self)
 {
-  PyMem_DEL(self);
+  PyObject_Del(self);
 }
 
 /* __repr__ */
@@ -161,18 +161,18 @@
 {
   PyMPICommunicatorObject *self;
 
-  self = PyObject_NEW(PyMPICommunicatorObject, &PyMPICommunicator_Type);
+  self = PyObject_New(PyMPICommunicatorObject, &PyMPICommunicator_Type);
   if (self == NULL)
     return NULL;
   self->handle = handle;
   if (MPI_Comm_rank(handle, &self->rank) != MPI_SUCCESS) {
     PyErr_SetString(PyExc_MPIError, "couldn't obtain communicator rank");
-    PyMem_DEL(self);
+    PyObject_Del(self);
     return NULL;
   }
   if (MPI_Comm_size(handle, &self->size) != MPI_SUCCESS) {
     PyErr_SetString(PyExc_MPIError, "couldn't obtain communicator size");
-    PyMem_DEL(self);
+    PyObject_Del(self);
     return NULL;
   }
   return self;
@@ -187,7 +187,7 @@
 {
   if (self->handle != MPI_COMM_WORLD)
     MPI_Comm_free(&self->handle);
-  PyMem_DEL(self);
+  PyObject_Del(self);
 }
 
 
@@ -1145,7 +1145,7 @@
 {
   PyMPIRequestObject *self;
 
-  self = PyObject_NEW(PyMPIRequestObject, &PyMPIRequest_Type);
+  self = PyObject_New(PyMPIRequestObject, &PyMPIRequest_Type);
   if (self == NULL)
     return NULL;
   self->handle[0] = rq;
@@ -1162,7 +1162,7 @@
 PyMPIRequest_dealloc(PyMPIRequestObject *self)
 {
   Py_XDECREF(self->buffer);  /* Release an eventual reference to the buffer */
-  PyMem_DEL(self);
+  PyObject_Del(self);
 }
 
 /* __repr__ */

Reply via email to