[Interface-dev] Problem with zope.interface leaking attributes

Brian Granger ellisonbg.net at gmail.com
Fri Oct 9 13:25:34 EDT 2009


Jim,

Thanks for the quick reply and confirming that these side effects are
unwanted.

I found a work around for my own code, but it would be great it these
things were eventually fixed in zope.interface.

Cheers,

Brian

On Fri, Oct 9, 2009 at 10:22 AM, Jim Fulton <jim at zope.com> wrote:

> On Fri, Oct 9, 2009 at 12:58 PM, Brian Granger <ellisonbg.net at gmail.com>
> wrote:
> > Hi,
> >
> > I am using zope.interface in a twisted based project.  I  have found two
> > interrelated unwanted side effects of
> > zope.interface.implements.  Here is a summary and self contained examples
> > that show the problem:
> >
> > 1) The __provides__ attribute propagates * up* an inheritance tree to
> > classes that know nothing of zope.interface.
>
> Yeah. This is a consequence of the caching strategy.
>
>
> > 2) The __provides__ attribute is a descriptor that will sometime raise an
> > AttributeError even though it is listed in dir(cls).
>
> Just because something's in a class __dict__ doesn't mean that it is
> accessible via getattr.  A descriptor can and often will raise an
> attribute error.
>
>
> > This means that things
> > like inspect.getmembers doesn't work.
>
> Yeah. Inspect is broken. (I really should fix that.)
>
> >  Because __provides__ propagates *up*
> > an inheritance tree, inspect.getmember has stopped working on all of my
> > classes even though they are plain old objects.
>
> Yeah, that's pretty lame.
>
> We really need to change the strategy for managing declarations.
>
> Jim
>
> --
> Jim Fulton
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.zope.org/pipermail/interface-dev/attachments/20091009/8b9981f4/attachment.html 


More information about the Interface-dev mailing list