On Thu, Jul 09, 2009 at 04:30:11PM +0100, Citi, Luca wrote:

> Also one could have an internal flag which says whether or not is safe
> to overwrite inputs with ref_count=1.
> Then import_array() sets this flag to "unsafe" (i.e. current behaviour).
> If the user of the numpy C-api is aware of how the new feature works,
> he/she can enable it by switching the flag to "safe" and act accordingly
> (increase refcounts before / decrease after) whenever he/she needs an array
> for later reuse.
> If possible, when imported from python (is there a way to know it? is
> import_array() called anyway?) the flag could be set to "safe".

Why complicate things ?

There is a simple rule which says that if you use an object
pointer as a function argument you must INCREF it. This is
just the logical consequence of using refcounted objects.

Creating exceptions to this will not simplify life, it
complicates the rules and will just lead to more bugs
and programmer frustration.

Ciao,

-- 
FA

Io lo dico sempre: l'Italia รจ troppo stretta e lunga.

_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to