You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After 1523b1c, it is no longer necessarily the case that c = ContainedProxy(obj); providedBy(c) is providedBy(c); previously it was.
Whether or not it is true depends on whether obj provides interfaces that overlap with ContainedProxy and which thus have to be removed.
Provides(cls, provided) in zope.interface does caching using (cls, provided) as the (strongly referenced) cache key. But the descriptor used to implement __provides__ for ContainedProxy calculates provided as a new object: provided = provided - duplicate_interface, and hashing of that object is based on identity.
(If someone keeps alive a reference to providedBy(c), it will also stick around uselessly forever. )
The text was updated successfully, but these errors were encountered:
>>> from zope.interface import*
>>> from zope.container.contained import ContainedProxy
>>> from persistent import Persistent
>>> classFoo: # No overlap
… pass
>>> c = ContainedProxy(Foo())
>>> providedBy(c) is providedBy(c)
True
>>> c = ContainedProxy(Persistent()) # These overlap
>>> providedBy(c) is providedBy(c)
False
After 1523b1c, it is no longer necessarily the case that
c = ContainedProxy(obj); providedBy(c) is providedBy(c)
; previously it was.Whether or not it is true depends on whether
obj
provides interfaces that overlap withContainedProxy
and which thus have to be removed.Provides(cls, provided)
in zope.interface does caching using(cls, provided)
as the (strongly referenced) cache key. But the descriptor used to implement__provides__
forContainedProxy
calculatesprovided
as a new object:provided = provided - duplicate_interface
, and hashing of that object is based on identity.(If someone keeps alive a reference to
providedBy(c)
, it will also stick around uselessly forever. )The text was updated successfully, but these errors were encountered: