On Thu, Jul 9, 2009 at 04:35, Pauli Virtanen<p...@iki.fi> wrote: > Thu, 09 Jul 2009 10:03:47 +0100, Citi, Luca kirjoitti: > [clip] >> Excuse me if I insist, PyArray_Conjugate is not the problem. If when >> using the numpy API, it is accepted something like: >> >> obj1 = PyArray_CreateSomehowAnArray(....); >> obj2 = PyArray_DoSomethingWithArray(obj1,...); >> obj3 = PyArray_DoSomethingElseWithArray(obj1,...); >> Py_DECREF(obj1); >> >> then there is no way my patch is guaranteed to not break things. > > So it seems. > > PyUFunc_GenericFunction is a part of the public C-API, so I guess this > discussion is moot. I doubt we can change ufunc semantics at this point, > and I don't see ways in which one could distinguish between "temporary > arrays" and refcount-1 arrays used in extension modules.
We could change ufunc_generic_call() (i.e. the C implementation of ufunc.__call__) to use a new function like PyUFunc_GenericFunction except with the refcount-1 semantics. This allows old C-level to remain unchanged but let Python expressions have the optimized semantics. Is there a hole in my reasoning? -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco _______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion