[Numpy-svn] r3284 - trunk/numpy/f2py/lib/src

numpy-svn at scipy.org numpy-svn at scipy.org
Sat Oct 7 03:50:30 CDT 2006


Author: pearu
Date: 2006-10-07 03:50:25 -0500 (Sat, 07 Oct 2006)
New Revision: 3284

Removed:
   trunk/numpy/f2py/lib/src/SCALARS_IN_BITS.cpp
   trunk/numpy/f2py/lib/src/pyobj_to_Py_complex.c
   trunk/numpy/f2py/lib/src/pyobj_to_double.c
   trunk/numpy/f2py/lib/src/pyobj_to_long.c
   trunk/numpy/f2py/lib/src/pyobj_to_npy_longlong.c
Log:
F2PY G3: clean up.

Deleted: trunk/numpy/f2py/lib/src/SCALARS_IN_BITS.cpp
===================================================================
--- trunk/numpy/f2py/lib/src/SCALARS_IN_BITS.cpp	2006-10-07 08:49:08 UTC (rev 3283)
+++ trunk/numpy/f2py/lib/src/SCALARS_IN_BITS.cpp	2006-10-07 08:50:25 UTC (rev 3284)
@@ -1,279 +0,0 @@
-#if NPY_BITSOF_LONG == 8
-#  ifndef PyInt8ScalarObject
-#    define PyInt8ScalarObject PyLongScalarObject
-#    define PyInt8ArrType_Type PyLongArrType_Type
-#  endif
-#elif NPY_BITSOF_LONG == 16
-#  ifndef PyInt16ScalarObject
-#    define PyInt16ScalarObject PyLongScalarObject
-#    define PyInt16ArrType_Type PyLongArrType_Type
-#  endif
-#elif NPY_BITSOF_LONG == 32
-#  ifndef PyInt32ScalarObject
-#    define PyInt32ScalarObject PyLongScalarObject
-#    define PyInt32ArrType_Type PyLongArrType_Type
-#  endif
-#elif NPY_BITSOF_LONG == 64
-#  ifndef PyInt64ScalarObject
-#    define PyInt64ScalarObject PyLongScalarObject
-#    define PyInt64ArrType_Type PyLongArrType_Type
-#  endif
-#elif NPY_BITSOF_LONG == 128
-#  ifndef PyInt128ScalarObject
-#    define PyInt128ScalarObject PyLongScalarObject
-#    define PyInt128ArrType_Type PyLongArrType_Type
-#  endif
-#endif
-
-#if NPY_BITSOF_LONGLONG == 8
-#  ifndef PyInt8ScalarObject
-#    define PyInt8ScalarObject PyLongLongScalarObject
-#    define PyInt8ArrType_Type PyLongLongArrType_Type
-#  endif
-#elif NPY_BITSOF_LONGLONG == 16
-#  ifndef PyInt16ScalarObject
-#    define PyInt16ScalarObject PyLongLongScalarObject
-#    define PyInt16ArrType_Type PyLongLongArrType_Type
-#  endif
-#elif NPY_BITSOF_LONGLONG == 32
-#  ifndef PyInt32ScalarObject
-#    define PyInt32ScalarObject PyLongLongScalarObject
-#    define PyInt32ArrType_Type PyLongLongArrType_Type
-#  endif
-#elif NPY_BITSOF_LONGLONG == 64
-#  ifndef PyInt64ScalarObject
-#    define PyInt64ScalarObject PyLongLongScalarObject
-#    define PyInt64ArrType_Type PyLongLongArrType_Type
-#  endif
-#elif NPY_BITSOF_LONGLONG == 128
-#  ifndef PyInt128ScalarObject
-#    define PyInt128ScalarObject PyLongLongScalarObject
-#    define PyInt128ArrType_Type PyLongLongArrType_Type
-#  endif
-#elif NPY_BITSOF_LONGLONG == 256
-#  ifndef PyInt256ScalarObject
-#    define PyInt256ScalarObject PyLongLongScalarObject
-#    define PyInt256ArrType_Type PyLongLongArrType_Type
-#  endif
-#endif
-
-#if NPY_BITSOF_INT == 8
-#  ifndef PyInt8ScalarObject
-#    define PyInt8ScalarObject PyIntScalarObject
-#    define PyInt8ArrType_Type PyIntArrType_Type
-#  endif
-#elif NPY_BITSOF_INT == 16
-#  ifndef PyInt16ScalarObject
-#    define PyInt16ScalarObject PyIntScalarObject
-#    define PyInt16ArrType_Type PyIntArrType_Type
-#  endif
-#elif NPY_BITSOF_INT == 32
-#  ifndef PyInt32ScalarObject
-#    define PyInt32ScalarObject PyIntScalarObject
-#    define PyInt32ArrType_Type PyIntArrType_Type
-#  endif
-#elif NPY_BITSOF_INT == 64
-#  ifndef PyInt64ScalarObject
-#    define PyInt64ScalarObject PyIntScalarObject
-#    define PyInt64ArrType_Type PyIntArrType_Type
-#  endif
-#elif NPY_BITSOF_INT == 128
-#  ifndef PyInt128ScalarObject
-#    define PyInt128ScalarObject PyIntScalarObject
-#    define PyInt128ArrType_Type PyIntArrType_Type
-#  endif
-#endif
-
-#if NPY_BITSOF_SHORT == 8
-#  ifndef PyInt8ScalarObject
-#    define PyInt8ScalarObject PyShortScalarObject
-#    define PyInt8ArrType_Type PyShortArrType_Type
-#  endif
-#elif NPY_BITSOF_SHORT == 16
-#  ifndef PyInt16ScalarObject
-#    define PyInt16ScalarObject PyShortScalarObject
-#    define PyInt16ArrType_Type PyShortArrType_Type
-#  endif
-#elif NPY_BITSOF_SHORT == 32
-#  ifndef PyInt32ScalarObject
-#    define PyInt32ScalarObject PyShortScalarObject
-#    define PyInt32ArrType_Type PyShortArrType_Type
-#  endif
-#elif NPY_BITSOF_SHORT == 64
-#  ifndef PyInt64ScalarObject
-#    define PyInt64ScalarObject PyShortScalarObject
-#    define PyInt64ArrType_Type PyShortArrType_Type
-#  endif
-#elif NPY_BITSOF_SHORT == 128
-#  ifndef PyInt128ScalarObject
-#    define PyInt128ScalarObject PyShortScalarObject
-#    define PyInt128ArrType_Type PyShortArrType_Type
-#  endif
-#endif
-
-#if NPY_BITSOF_CHAR == 8
-#  ifndef PyInt8ScalarObject
-#    define PyInt8ScalarObject PyByteScalarObject
-#    define PyInt8ArrType_Type PyByteArrType_Type
-#  endif
-#elif NPY_BITSOF_CHAR == 16
-#  ifndef PyInt16ScalarObject
-#    define PyInt16ScalarObject PyByteScalarObject
-#    define PyInt16ArrType_Type PyByteArrType_Type
-#  endif
-#elif NPY_BITSOF_CHAR == 32
-#  ifndef PyInt32ScalarObject
-#    define PyInt32ScalarObject PyByteScalarObject
-#    define PyInt32ArrType_Type PyByteArrType_Type
-#  endif
-#elif NPY_BITSOF_CHAR == 64
-#  ifndef PyInt64ScalarObject
-#    define PyInt64ScalarObject PyByteScalarObject
-#    define PyInt64ArrType_Type PyByteArrType_Type
-#  endif
-#elif NPY_BITSOF_CHAR == 128
-#  ifndef PyInt128ScalarObject
-#    define PyInt128ScalarObject PyByteScalarObject
-#    define PyInt128ArrType_Type PyByteArrType_Type
-#  endif
-#endif
-
-#if NPY_BITSOF_DOUBLE == 16
-#  ifndef PyFloat16ScalarObject
-#    define PyFloat16ScalarObject PyDoubleScalarObject
-#    define PyComplex32ScalarObject PyCDoubleScalarObject
-#    define PyFloat16ArrType_Type PyDoubleArrType_Type
-#    define PyComplex32ArrType_Type PyCDoubleArrType_Type
-#  endif
-#elif NPY_BITSOF_DOUBLE == 32
-#  ifndef PyFloat32ScalarObject
-#    define PyFloat32ScalarObject PyDoubleScalarObject
-#    define PyComplex64ScalarObject PyCDoubleScalarObject
-#    define PyFloat32ArrType_Type PyDoubleArrType_Type
-#    define PyComplex64ArrType_Type PyCDoubleArrType_Type
-#  endif
-#elif NPY_BITSOF_DOUBLE == 64
-#  ifndef PyFloat64ScalarObject
-#    define PyFloat64ScalarObject PyDoubleScalarObject
-#    define PyComplex128ScalarObject PyCDoubleScalarObject
-#    define PyFloat64ArrType_Type PyDoubleArrType_Type
-#    define PyComplex128ArrType_Type PyCDoubleArrType_Type
-#  endif
-#elif NPY_BITSOF_DOUBLE == 80
-#  ifndef PyFloat80ScalarObject
-#    define PyFloat80ScalarObject PyDoubleScalarObject
-#    define PyComplex160ScalarObject PyCDoubleScalarObject
-#    define PyFloat80ArrType_Type PyDoubleArrType_Type
-#    define PyComplex160ArrType_Type PyCDoubleArrType_Type
-#  endif
-#elif NPY_BITSOF_DOUBLE == 96
-#  ifndef PyFloat96ScalarObject
-#    define PyFloat96ScalarObject PyDoubleScalarObject
-#    define PyComplex192ScalarObject PyCDoubleScalarObject
-#    define PyFloat96ArrType_Type PyDoubleArrType_Type
-#    define PyComplex192ArrType_Type PyCDoubleArrType_Type
-#  endif
-#elif NPY_BITSOF_DOUBLE == 128
-#  ifndef PyFloat128ScalarObject
-#    define PyFloat128ScalarObject PyDoubleScalarObject
-#    define PyComplex256ScalarObject PyCDoubleScalarObject
-#    define PyFloat128ArrType_Type PyDoubleArrType_Type
-#    define PyComplex256ArrType_Type PyCDoubleArrType_Type
-#  endif
-#endif
-
-#if NPY_BITSOF_FLOAT == 16
-#  ifndef PyFloat16ScalarObject
-#    define PyFloat16ScalarObject PyFloatScalarObject
-#    define PyComplex32ScalarObject PyCFloatScalarObject
-#    define PyFloat16ArrType_Type PyFloatArrType_Type
-#    define PyComplex32ArrType_Type PyCFloatArrType_Type
-#  endif
-#elif NPY_BITSOF_FLOAT == 32
-#  ifndef PyFloat32ScalarObject
-#    define PyFloat32ScalarObject PyFloatScalarObject
-#    define PyComplex64ScalarObject PyCFloatScalarObject
-#    define PyFloat32ArrType_Type PyFloatArrType_Type
-#    define PyComplex64ArrType_Type PyCFloatArrType_Type
-#  endif
-#elif NPY_BITSOF_FLOAT == 64
-#  ifndef PyFloat64ScalarObject
-#    define PyFloat64ScalarObject PyFloatScalarObject
-#    define PyComplex128ScalarObject PyCFloatScalarObject
-#    define PyFloat64ArrType_Type PyFloatArrType_Type
-#    define PyComplex128ArrType_Type PyCFloatArrType_Type
-#  endif
-#elif NPY_BITSOF_FLOAT == 80
-#  ifndef PyFloat80ScalarObject
-#    define PyFloat80ScalarObject PyFloatScalarObject
-#    define PyComplex160ScalarObject PyCFloatScalarObject
-#    define PyFloat80ArrType_Type PyFloatArrType_Type
-#    define PyComplex160ArrType_Type PyCFloatArrType_Type
-#  endif
-#elif NPY_BITSOF_FLOAT == 96
-#  ifndef PyFloat96ScalarObject
-#    define PyFloat96ScalarObject PyFloatScalarObject
-#    define PyComplex192ScalarObject PyCFloatScalarObject
-#    define PyFloat96ArrType_Type PyFloatArrType_Type
-#    define PyComplex192ArrType_Type PyCFloatArrType_Type
-#  endif
-#elif NPY_BITSOF_FLOAT == 128
-#  ifndef PyFloat128ScalarObject
-#    define PyFloat128ScalarObject PyFloatScalarObject
-#    define PyComplex256ScalarObject PyCFloatScalarObject
-#    define PyFloat128ArrType_Type PyFloatArrType_Type
-#    define PyComplex256ArrType_Type PyCFloatArrType_Type
-#  endif
-#endif
-
-#if NPY_BITSOF_LONGDOUBLE == 16
-#  ifndef PyFloat16ScalarObject
-#    define PyFloat16ScalarObject PyLongDoubleScalarObject
-#    define PyComplex32ScalarObject PyCLongDoubleScalarObject
-#    define PyFloat16ArrType_Type PyLongDoubleArrType_Type
-#    define PyComplex32ArrType_Type PyCLongDoubleArrType_Type
-#  endif
-#elif NPY_BITSOF_LONGDOUBLE == 32
-#  ifndef PyFloat32ScalarObject
-#    define PyFloat32ScalarObject PyLongDoubleScalarObject
-#    define PyComplex64ScalarObject PyCLongDoubleScalarObject
-#    define PyFloat32ArrType_Type PyLongDoubleArrType_Type
-#    define PyComplex64ArrType_Type PyCLongDoubleArrType_Type
-#  endif
-#elif NPY_BITSOF_LONGDOUBLE == 64
-#  ifndef PyFloat64ScalarObject
-#    define PyFloat64ScalarObject PyLongDoubleScalarObject
-#    define PyComplex128ScalarObject PyCLongDoubleScalarObject
-#    define PyFloat64ArrType_Type PyLongDoubleArrType_Type
-#    define PyComplex128ArrType_Type PyCLongDoubleArrType_Type
-#  endif
-#elif NPY_BITSOF_LONGDOUBLE == 80
-#  ifndef PyFloat80ScalarObject
-#    define PyFloat80ScalarObject PyLongDoubleScalarObject
-#    define PyComplex160ScalarObject PyCLongDoubleScalarObject
-#    define PyFloat80ArrType_Type PyLongDoubleArrType_Type
-#    define PyComplex160ArrType_Type PyCLongDoubleArrType_Type
-#  endif
-#elif NPY_BITSOF_LONGDOUBLE == 96
-#  ifndef PyFloat96ScalarObject
-#    define PyFloat96ScalarObject PyLongDoubleScalarObject
-#    define PyComplex192ScalarObject PyCLongDoubleScalarObject
-#    define PyFloat96ArrType_Type PyLongDoubleArrType_Type
-#    define PyComplex192ArrType_Type PyCLongDoubleArrType_Type
-#  endif
-#elif NPY_BITSOF_LONGDOUBLE == 128
-#  ifndef PyFloat128ScalarObject
-#    define PyFloat128ScalarObject PyLongDoubleScalarObject
-#    define PyComplex256ScalarObject PyCLongDoubleScalarObject
-#    define PyFloat128ArrType_Type PyLongDoubleArrType_Type
-#    define PyComplex256ArrType_Type PyCLongDoubleArrType_Type
-#  endif
-#elif NPY_BITSOF_LONGDOUBLE == 256
-#  ifndef PyFloat256ScalarObject
-#    define PyFloat256ScalarObject PyLongDoubleScalarObject
-#    define PyComplex512ScalarObject PyCLongDoubleScalarObject
-#    define PyFloat256ArrType_Type PyLongDoubleArrType_Type
-#    define PyComplex512ArrType_Type PyCLongDoubleArrType_Type
-#  endif
-#endif
-

Deleted: trunk/numpy/f2py/lib/src/pyobj_to_Py_complex.c
===================================================================
--- trunk/numpy/f2py/lib/src/pyobj_to_Py_complex.c	2006-10-07 08:49:08 UTC (rev 3283)
+++ trunk/numpy/f2py/lib/src/pyobj_to_Py_complex.c	2006-10-07 08:50:25 UTC (rev 3284)
@@ -1,73 +0,0 @@
-int pyobj_to_Py_complex(PyObject* obj, Py_complex* value) {
-  int return_value = 0;
-#if defined(F2PY_DEBUG_PYOBJ_TOFROM)
-  fprintf(stderr,"pyobj_to_Py_complex(type=%s)\n",PyString_AS_STRING(PyObject_Repr(PyObject_Type(obj))));
-#endif
-  if (PyArray_CheckScalar(obj)) {
-    if (PyArray_IsScalar(obj, CDouble)) {
-      npy_cdouble obval = PyArrayScalar_VAL(obj, CDouble);
-      value->real = obval.real;
-      value->imag = obval.imag;
-      return_value = 1;
-      goto capi_done;
-    }
-    else if (PyArray_IsScalar(obj, CFloat)) {
-      npy_cfloat obval = PyArrayScalar_VAL(obj, CFloat);
-      value->real = obval.real;
-      value->imag = obval.imag;
-      return_value = 1;
-      goto capi_done;
-    }
-  }
-  if (PyComplex_Check(obj)) {
-    *value = PyComplex_AsCComplex(obj);
-    return_value = 1;
-    goto capi_done;
-  }
-  /* Python does not provide PyNumber_Complex function :-( */
-  value->imag=0.0;
-  if (PyFloat_Check(obj)) {
-#ifdef __sgi
-    value->real = PyFloat_AsDouble(obj);
-    return_value = !PyErr_Occurred()
-#else
-    value->real = PyFloat_AS_DOUBLE(obj);
-    return_value = 1;
-#endif
-    goto capi_done;
-  }
-  if (PyInt_Check(obj)) {
-    value->real = (double)PyInt_AS_LONG(obj);
-    return_value = 1;
-    goto capi_done;
-  }
-  if (PyLong_Check(obj)) {
-    value->real = PyLong_AsDouble(obj);
-    return_value = !PyErr_Occurred();;
-    goto capi_done;
-  }
-  if (PyString_Check(obj))
-    /*pass*/;
-  else if (PySequence_Check(obj) && PySequence_Size(obj)==1) {
-    PyObject *tmp = PySequence_GetItem(obj,0);
-    if (tmp) {
-      if (pyobj_to_Py_complex(tmp,value)) {
-        Py_DECREF(tmp);
-	return_value = 1;
-	goto capi_done;
-      }
-      Py_DECREF(tmp);
-    }
-  }
-  if (!PyErr_Occurred()) {
-    PyObject* r = PyString_FromString("Failed to convert ");
-    PyString_ConcatAndDel(&r, PyObject_Repr(PyObject_Type(obj)));
-    PyString_ConcatAndDel(&r, PyString_FromString(" to C Py_complex"));
-    PyErr_SetObject(PyExc_TypeError,r);
-  }
- capi_done:
-#if defined(F2PY_DEBUG_PYOBJ_TOFROM)
-  fprintf(stderr,"pyobj_to_Py_complex: return_value=%d, PyErr_Occurred()=%p\n", return_value, PyErr_Occurred());
-#endif
-  return return_value;
-}

Deleted: trunk/numpy/f2py/lib/src/pyobj_to_double.c
===================================================================
--- trunk/numpy/f2py/lib/src/pyobj_to_double.c	2006-10-07 08:49:08 UTC (rev 3283)
+++ trunk/numpy/f2py/lib/src/pyobj_to_double.c	2006-10-07 08:50:25 UTC (rev 3284)
@@ -1,61 +0,0 @@
-int pyobj_to_double(PyObject* obj, double* value) {
-  int return_value = 0;
-#if defined(F2PY_DEBUG_PYOBJ_TOFROM)
-  fprintf(stderr,"pyobj_to_double(type=%s)\n",PyString_AS_STRING(PyObject_Repr(PyObject_Type(obj))));
-#endif
-  PyObject* tmp = NULL;
-  if (PyFloat_Check(obj)) {
-#ifdef __sgi
-    *value = PyFloat_AsDouble(obj);
-    return_value = !PyErr_Occurred();
-    goto capi_done;
-#else
-    *value = PyFloat_AS_DOUBLE(obj);
-    return_value = 1;
-    goto capi_done;
-#endif
-  }
-  tmp = PyNumber_Float(obj);
-  if (tmp) {
-#ifdef __sgi
-    *value = PyFloat_AsDouble(tmp);
-    Py_DECREF(tmp);
-    return_value = !PyErr_Occurred();
-    goto capi_done;
-#else
-    *value = PyFloat_AS_DOUBLE(tmp);
-    Py_DECREF(tmp);
-    return_value = 1;
-    goto capi_done;
-#endif
-  }
-  /*
-  if (PyComplex_Check(obj))
-    tmp = PyObject_GetAttrString(obj,"real");
-  else 
-  */
-  if (PyString_Check(obj))
-    /*pass*/;
-  else if (PySequence_Check(obj) && PySequence_Size(obj)==1)
-    tmp = PySequence_GetItem(obj,0);
-  if (tmp) {
-    PyErr_Clear();
-    if (pyobj_to_double(tmp, value)) {
-      Py_DECREF(tmp); 
-      return_value = 1;
-      goto capi_done;
-    }
-    Py_DECREF(tmp);
-  }
-  if (!PyErr_Occurred()) {
-    PyObject* r = PyString_FromString("Failed to convert ");
-    PyString_ConcatAndDel(&r, PyObject_Repr(PyObject_Type(obj)));
-    PyString_ConcatAndDel(&r, PyString_FromString(" to C double"));
-    PyErr_SetObject(PyExc_TypeError,r);
-  }
- capi_done:
-#if defined(F2PY_DEBUG_PYOBJ_TOFROM)
-  fprintf(stderr,"pyobj_to_double: return_value=%d, PyErr_Occurred()=%p\n", return_value, PyErr_Occurred());
-#endif
-  return return_value;
-}

Deleted: trunk/numpy/f2py/lib/src/pyobj_to_long.c
===================================================================
--- trunk/numpy/f2py/lib/src/pyobj_to_long.c	2006-10-07 08:49:08 UTC (rev 3283)
+++ trunk/numpy/f2py/lib/src/pyobj_to_long.c	2006-10-07 08:50:25 UTC (rev 3284)
@@ -1,48 +0,0 @@
-int pyobj_to_long(PyObject *obj, long* value) {
-  int return_value = 0;
-  PyObject* tmp = NULL;
-#if defined(F2PY_DEBUG_PYOBJ_TOFROM)
-  fprintf(stderr,"pyobj_to_long(type=%s)\n",PyString_AS_STRING(PyObject_Repr(PyObject_Type(obj))));
-#endif
-  if (PyInt_Check(obj)) {
-    *value = PyInt_AS_LONG(obj);
-    return_value = 1;
-    goto capi_done;
-  }
-  tmp = PyNumber_Int(obj);
-  if (tmp) {
-    *value = PyInt_AS_LONG(tmp);
-    Py_DECREF(tmp);
-    return_value = 1;
-    goto capi_done;
-  }
-  /*
-  if (PyComplex_Check(obj))
-    tmp = PyObject_GetAttrString(obj,"real");
-  else
-  */ 
-  if (PyString_Check(obj))
-    /*pass*/;
-  else if (PySequence_Check(obj) && PySequence_Size(obj)==1)
-    tmp = PySequence_GetItem(obj,0);
-  if (tmp) {
-    PyErr_Clear();
-    if (pyobj_to_long(tmp, value)) {
-      Py_DECREF(tmp);
-      return_value = 1;
-      goto capi_done;
-    }
-    Py_DECREF(tmp);
-  }
-  if (!PyErr_Occurred()) {
-    PyObject* r = PyString_FromString("Failed to convert ");
-    PyString_ConcatAndDel(&r, PyObject_Repr(PyObject_Type(obj)));
-    PyString_ConcatAndDel(&r, PyString_FromString(" to C long"));
-    PyErr_SetObject(PyExc_TypeError,r);
-  }
- capi_done:
-#if defined(F2PY_DEBUG_PYOBJ_TOFROM)
-  fprintf(stderr,"pyobj_to_long: return_value=%d, PyErr_Occurred()=%p\n", return_value, PyErr_Occurred());
-#endif
-  return return_value;
-}

Deleted: trunk/numpy/f2py/lib/src/pyobj_to_npy_longlong.c
===================================================================
--- trunk/numpy/f2py/lib/src/pyobj_to_npy_longlong.c	2006-10-07 08:49:08 UTC (rev 3283)
+++ trunk/numpy/f2py/lib/src/pyobj_to_npy_longlong.c	2006-10-07 08:50:25 UTC (rev 3284)
@@ -1,54 +0,0 @@
-int pyobj_to_npy_longlong(PyObject *obj, npy_longlong* value) {
-  int return_value = 0;
-#if defined(F2PY_DEBUG_PYOBJ_TOFROM)
-  fprintf(stderr,"pyobj_to_npy_longlong(type=%s)\n",PyString_AS_STRING(PyObject_Repr(PyObject_Type(obj))));
-#endif
-  PyObject* tmp = NULL;
-  if (PyLong_Check(obj)) {
-    *value = PyLong_AsLongLong(obj);
-    return_value = !PyErr_Occurred();
-    goto capi_done;
-  }
-  if (PyInt_Check(obj)) {
-    *value = (npy_longlong)PyInt_AS_LONG(obj);
-    return_value = 1;
-    goto capi_done;
-  }
-  tmp = PyNumber_Long(obj);
-  if (tmp) {
-    *value = PyLong_AsLongLong(tmp);
-    Py_DECREF(tmp);
-    return_value = !PyErr_Occurred();
-    goto capi_done;
-  }
-  /*
-  if (PyComplex_Check(obj))
-    tmp = PyObject_GetAttrString(obj,"real");
-  else
-  */
-  if (PyString_Check(obj))
-    /*pass*/;
-  else if (PySequence_Check(obj) && PySequence_Size(obj)==1)
-    tmp = PySequence_GetItem(obj,0);
-  if (tmp) {
-    PyErr_Clear();
-    if (pyobj_to_npy_longlong(tmp, value)) {
-      Py_DECREF(tmp);
-      return_value = 1;
-      goto capi_done;
-    }
-    Py_DECREF(tmp);
-  }
-  if (!PyErr_Occurred()) {
-    PyObject* r = PyString_FromString("Failed to convert ");
-    PyString_ConcatAndDel(&r, PyObject_Repr(PyObject_Type(obj)));
-    PyString_ConcatAndDel(&r, PyString_FromString(" to C npy_longlong"));
-    PyErr_SetObject(PyExc_TypeError,r);
-  }
- capi_done:
-#if defined(F2PY_DEBUG_PYOBJ_TOFROM)
-  fprintf(stderr,"pyobj_to_npy_longlong: return_value=%d, PyErr_Occurred()=%p\n", return_value, PyErr_Occurred());
-#endif
-  return return_value;
-}
-



More information about the Numpy-svn mailing list