diff options
| author | Jason Madden <jamadden@gmail.com> | 2020-01-27 09:31:30 -0600 |
|---|---|---|
| committer | Jason Madden <jamadden@gmail.com> | 2020-01-27 09:31:30 -0600 |
| commit | f41ebfdb0b432fd99e1c44c0a1d7fd54a637bdf8 (patch) | |
| tree | b15c734c418a50d33d0957964dd962c61fe33db9 /src/zope/interface/interface.py | |
| parent | fec4a51b1ce8526de23c2558bfd26e253c4b6250 (diff) | |
| download | zope-interface-issue157.tar.gz | |
Remove support for hashing uninitialized interfaces.issue157
Fixes #157
Diffstat (limited to 'src/zope/interface/interface.py')
| -rw-r--r-- | src/zope/interface/interface.py | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/src/zope/interface/interface.py b/src/zope/interface/interface.py index 106a60d..7fa56aa 100644 --- a/src/zope/interface/interface.py +++ b/src/zope/interface/interface.py @@ -17,7 +17,6 @@ import sys from types import MethodType from types import FunctionType -import warnings import weakref from zope.interface._compat import _use_c_impl @@ -579,7 +578,7 @@ class InterfaceClass(Element, InterfaceBase, Specification): if other is None: return -1 - n1 = (getattr(self, '__name__', ''), getattr(self, '__module__', '')) + n1 = (self.__name__, self.__module__) n2 = (getattr(other, '__name__', ''), getattr(other, '__module__', '')) # This spelling works under Python3, which doesn't have cmp(). @@ -589,11 +588,7 @@ class InterfaceClass(Element, InterfaceBase, Specification): try: return self._v_cached_hash except AttributeError: - try: - self._v_cached_hash = hash((self.__name__, self.__module__)) - except AttributeError: # pragma: no cover - warnings.warn('Hashing uninitialized InterfaceClass instance') - return 1 + self._v_cached_hash = hash((self.__name__, self.__module__)) return self._v_cached_hash def __eq__(self, other): |
