Re: SEGFAULT using ComputedAttribute

Donovan Baarda <[email protected]>
Newsgroups gmane.comp.web.zope.coders
Organization http://minkirri.apana.org.au/~abo/
Message-ID <1106098462.3822.19.camel@schizo>
On Tue, 2005-01-18 at 21:12 -0200, Dorneles Treméa wrote:
> Hello folks,
[...]
> call. When I try to use the ComputedAttribute trick, I make Zope
> SEGFAULT... :-(

I'm not familiar with your particular application, but I thought I'd
offer some observations about our experiences with ComputedAttribute
that may help.

ComputedAttribute is buried in C extension land, but it calls back to
Python land when it invokes the method. If _any_ exception is raised by
the Python method, it is not handled in C land and you get a segfault.
You can find these kinds of errors by putting a catch-all exception
handler in your computed attribute method that prints out diagnostics.

It is very easy to find yourself in recursive-land, recursing until you
run out of memory and get a segfault. Make sure there is no way that
your computed attribute method tries to access its own attribute, or
another computed attribute that depends on this attribute.

When you pass in the extra '1' to indicate "use aquisition wrappers",
you actually end up with "self" aquistion wrapped as in self.aq_inner.
This means you get only the "containment" wrapper. There doesn't seem to
be any way to make it use the full aquisition wrappers. I think this is
a result of how it is implemented. If your method does not rely on the
object being aquisition wrapped, it is better to not specify "1".

-- 
Donovan Baarda <[email protected]>
http://minkirri.apana.org.au/~abo/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.