On Fri, 27 Aug 2010 15:14:02 -0300, Lisandro Dalcin <dalcinl at gmail.com> wrote: > I cannot figure out how to implement a copy-free and safe > VecGetArray()/VecRestoreArray() pattern in Python (not even by using > the 'with' statement, it leaks the target variable!!!!).
What exactly leaks?
I envision
with X.getArray() as x:
x[0] = 1.
and
with Vec.getArrays(X,Y,Z) as (x,y,z):
x = y + z # Numpy vectorized addition
instead of cascading with statements
Jed
