Commits

Bob Ippolito committed fb97080

break when protocol is found

Comments (0)

Files changed (1)

Lib/objc/_protocols.py

         pass
     for cls in _objc.getClassList():
         for p in _objc.protocolsForClass(cls):
-            PROTOCOL_CACHE.setdefault(p.name(), p)
-    try:
-        return PROTOCOL_CACHE[name]
-    except KeyError:
-        raise ProtocolError("protocol %r does not exist" % (name,), name)
+            pname = p.name()
+            PROTOCOL_CACHE.setdefault(pname, p)
+            if pname == name:
+                return p
+    raise ProtocolError("protocol %r does not exist" % (name,), name)