diff options
author | Jason Madden <jamadden@gmail.com> | 2021-03-17 11:11:19 -0500 |
---|---|---|
committer | Jason Madden <jamadden@gmail.com> | 2021-03-17 11:11:19 -0500 |
commit | 45b9294e9d3b8c679df0ae029de6b1792b183782 (patch) | |
tree | aa91a2dbe549aa9ca1cd28920ef409af4c81f1f9 /src/zope/interface/interface.py | |
parent | 762c253064dde6ee1ccd7b5ade7de7be357bf0b4 (diff) | |
download | zope-interface-issue207.tar.gz |
Make Provides and ClassProvides ignore redundant interfaces like @implementerissue207
cf #207
Diffstat (limited to 'src/zope/interface/interface.py')
-rw-r--r-- | src/zope/interface/interface.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/zope/interface/interface.py b/src/zope/interface/interface.py index d100aae..c5d1852 100644 --- a/src/zope/interface/interface.py +++ b/src/zope/interface/interface.py @@ -413,6 +413,13 @@ class Specification(SpecificationBase): __setBases, ) + # This method exists for tests to override the way we call + # ro.calculate_ro(), usually by adding extra kwargs. We don't + # want to have a mutable dictionary as a class member that we pass + # ourself because mutability is bad, and passing **kw is slower than + # calling the bound function. + _do_calculate_ro = calculate_ro + def _calculate_sro(self): """ Calculate and return the resolution order for this object, using its ``__bases__``. @@ -448,7 +455,7 @@ class Specification(SpecificationBase): # This requires that by the time this method is invoked, our bases # have settled their SROs. Thus, ``changed()`` must first # update itself before telling its descendents of changes. - sro = calculate_ro(self, base_mros={ + sro = self._do_calculate_ro(base_mros={ b: b.__sro__ for b in self.__bases__ }) |