[Numpy-tickets] [NumPy] #747: Reference counting bug in call to ufunc object loops.

NumPy numpy-tickets@scipy....
Sat Apr 19 21:50:20 CDT 2008


#747: Reference counting bug in call to ufunc object loops.
------------------------+---------------------------------------------------
 Reporter:  charris     |       Owner:  somebody
     Type:  defect      |      Status:  new     
 Priority:  normal      |   Milestone:  1.1.0   
Component:  numpy.core  |     Version:  none    
 Severity:  normal      |    Keywords:          
------------------------+---------------------------------------------------
 The following code tests out fine if I comment out the Py_XDECREF.


 {{{
 static void
 PyUFunc_O_O_method(char **args, intp *dimensions, intp *steps, void *func)
 {
     intp n = dimensions[0];
     intp is1 = steps[0];
     intp is2 = steps[1];
     char *ip1 = args[0];
     char *op = args[1];
     char *meth = (char *)func;
     intp i;

     for(i = 0; i < n; i++, ip1 += is1, op += is2) {
         PyObject *in1 = *(PyObject **)ip1;
         PyObject **out = (PyObject **)op;
         PyObject *ret = PyObject_CallMethod(in1, meth, NULL);

         if (ret == NULL) {
             return;
         }
         Py_XDECREF(*out);
         *out = ret;
     }
 }

 }}}

-- 
Ticket URL: <http://scipy.org/scipy/numpy/ticket/747>
NumPy <http://projects.scipy.org/scipy/numpy>
The fundamental package needed for scientific computing with Python.


More information about the Numpy-tickets mailing list