summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Madden <jamadden@gmail.com>2020-03-18 16:59:11 -0500
committerJason Madden <jamadden@gmail.com>2020-03-18 16:59:11 -0500
commitdc719e296d6f8ccf5d989414d0af6d645a93c940 (patch)
tree107cc5c8200f2a6cb4dca8c531e5944483f5ea38
parent6be183e34defe640bbad3d898fa3468bf292438a (diff)
downloadzope-interface-faster-eq-hash-comparison.tar.gz
Remove untested except in the metaclass __new__.faster-eq-hash-comparison
Reviewers weren't sure how it could be raised.
-rw-r--r--src/zope/interface/interface.py12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/zope/interface/interface.py b/src/zope/interface/interface.py
index 01af422..2d9a873 100644
--- a/src/zope/interface/interface.py
+++ b/src/zope/interface/interface.py
@@ -603,13 +603,11 @@ class _InterfaceMetaClass(type):
# make people's heads hurt. (But still less than the descriptor-is-string, I think.)
def __new__(cls, name, bases, attrs):
- try:
- # Figure out what module defined the interface.
- # This is how cPython figures out the module of
- # a class, but of course it does it in C. :-/
- __module__ = sys._getframe(1).f_globals['__name__']
- except (AttributeError, KeyError): # pragma: no cover
- pass
+ # Figure out what module defined the interface.
+ # This is copied from ``InterfaceClass.__init__``;
+ # reviewers aren't sure how AttributeError or KeyError
+ # could be raised.
+ __module__ = sys._getframe(1).f_globals['__name__']
# Get the C optimized __module__ accessor and give it
# to the new class.
moduledescr = InterfaceBase.__dict__['__module__']