[Zope3-dev] Interface.Implements module still broken for 2.2 metaclasses

Steve Alexander steve@cat-box.net
Sun, 07 Jul 2002 21:20:28 +0100


Phillip J. Eby wrote:
> The Interface.Implements module's getImplements() and 
> getImplementsOfInstances() do not yield correct results for Python 2.2 
> metaclass instances; that is, objects which inherit from 'type'.  The 
> correction is straightforward, they need to use 'isinstance()'-based 
> checks rather than 'type()' checks.  (And I have verified that they 
> operate correctly with such a change.)  Unfortunately, I'm not sure that 
> this can be properly backported to Python 2.1.

I think that if they are changed to use isinstance(), they will no 
longer work with context wrappers and security proxies.

The solution is that isinstance in python 2.3 will take into account the 
__class__ attribute of the object, so a semi-transparent proxy can 
publish its inner object's __class__ attribute.

--
Steve Alexander