[Numpy-discussion] RE: NA_updateDataPtr segmentation fault bug?

Marco Bubke marco at bubke.de
Wed Feb 25 08:36:11 CST 2004


Ok

cdef NumArray array_to_float(NumArray array):
  cdef NumArray new_array
  new_array = array
  NA_updateDataPtr(new_array)
  NA_updateDataPtr(new_array)
  flat_array = NA_InputArray(array, tFloat32, NUM_C_ARRAY)
  return flat_array

Here the C code:

static PyArrayObject *__pyx_f_2gl_array_to_float(PyArrayObject *__pyx_v_array) 
{
  PyArrayObject *__pyx_v_new_array;
  PyObject *__pyx_v_flat_array;
  PyArrayObject *__pyx_r;
  PyObject *__pyx_1 = 0;
  Py_INCREF(__pyx_v_array);
  ((PyObject*)__pyx_v_new_array) = Py_None; 
Py_INCREF(((PyObject*)__pyx_v_new_array));
  __pyx_v_flat_array = Py_None; Py_INCREF(__pyx_v_flat_array);

  /* "/home/marco/projects/calliopeia/numarray.pxd":102 */
  Py_INCREF(((PyObject *)__pyx_v_array));
  Py_DECREF(((PyObject *)__pyx_v_new_array));
  ((PyObject *)__pyx_v_new_array) = ((PyObject *)__pyx_v_array);

  /* "/home/marco/projects/calliopeia/numarray.pxd":103 */
  __pyx_1 = NA_updateDataPtr(((PyObject *)__pyx_v_new_array)); if (!__pyx_1) 
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; goto __pyx_L
1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;

  /* "/home/marco/projects/calliopeia/numarray.pxd":104 */
  __pyx_1 = NA_updateDataPtr(((PyObject *)__pyx_v_new_array)); if (!__pyx_1) 
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; goto __pyx_L
1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;

  /* "/home/marco/projects/calliopeia/numarray.pxd":105 */
  __pyx_1 = NA_InputArray(((PyObject *)__pyx_v_array),tFloat32,NUM_C_ARRAY); 
if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105
; goto __pyx_L1;}
  Py_DECREF(__pyx_v_flat_array);
  __pyx_v_flat_array = __pyx_1;
  __pyx_1 = 0;

  /* "/home/marco/projects/calliopeia/numarray.pxd":106 */
  if (!__Pyx_TypeTest(__pyx_v_flat_array, __pyx_ptype_2gl__numarray)) 
{__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; goto __pyx_L1;}
  Py_INCREF(__pyx_v_flat_array);
  __pyx_r = (PyArrayObject *)__pyx_v_flat_array;
  goto __pyx_L0;

  (PyObject *)__pyx_r = Py_None; Py_INCREF((PyObject *)__pyx_r);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  __Pyx_AddTraceback("gl.array_to_float");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_new_array);
  Py_DECREF(__pyx_v_flat_array);
  Py_DECREF(__pyx_v_array);
  return ((PyArrayObject *)__pyx_r) ;
}






More information about the Numpy-discussion mailing list