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

Jim Fulton jim at zope.com
Fri Oct 9 13:22:01 EDT 2009


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


More information about the Interface-dev mailing list