[SciPy-user] problem with weave tutorial
Tue May 27 18:17:31 CDT 2008
> Since apparently there is no written resource that reliably explains things like
> the following question for the current weave, I'll ask it here:
I should also point out that Travis' numpy book does have a few decent
chapters on weave, but IIRC it doesn't answer your questions.
> The examples you give:
> a = weave.inline("return_val = py::object(a+1);",['a'])
> a = weave.inline("return_val = a+1;", ['a'])
> don't explicitly do anything with reference counting. Can you give any hints about if/when it
> is necessary to explicitly deal with reference counting when using Weave? I'd rather not have
> to extrapolate that info purely from the examples -- but I will if necessary, of course.
AFAIK, never. The core of weave is the scxx library, and you can look
in scipy/weave/scxx/object.h to see how it works. It has a lot of
well-commented code dealing with reference counting in there, so I
believe everything is handled automatically. If you have specific
questions, that might be a good place to look.
In my experience, the cpp code generated by weave is actually fairly
easy to examine and figure out what's going on.
UBC Department of Computer Science
More information about the SciPy-user