[C++-sig] Re: numarray 1.0 and BPL - oops
Francois Ostiguy
ostiguy at fnal.gov
Wed Sep 1 21:48:24 CEST 2004
the code that works for me is exactly as follows:
long array_base::nelements() const
{
return extract<long>( attr("nelements")() );
}
I make no claim about correctness ... I am not familiar enough with the
low level details of BPL.
What is certain is that the current code
long array_base::nelements() const
{
return extract<long>( attr("nelements") );
}
^^^^
i.e. without operator()
does not work (numarray 1.0/bpl 1_31/gcc-3.3.3).
The error message:
TypeError: No registered converter was able to produce a C++ rvalue of
type long from this Python object of type builtin_function_or_method.
seems to be generated because attr("nelements") returns a callable
PyObject* that cannot be converted to a long.
The relevant function from the numarray code (1.0) seems to be
static PyObject *
_ndarray_nelements(PyArrayObject *self, PyObject *args)
{
if (!PyArg_ParseTuple(args, ":nelements"))
return NULL;
return PyInt_FromLong(NA_elements(self));
}
-Francois
----------------------------------------------------------------------------
Dr. Jean-Francois OSTIGUY voice: (630) 840-2231
Beam Physics Dept MS220 FAX: (630) 840-6039
Fermi National Accelerator Laboratory email: ostiguy at fnal.gov
Batavia IL 60510-0500 WWW:www-ap.fnal.gov/~ostiguy
More information about the Cplusplus-sig
mailing list