Kaydet (Commit) 33794a7b authored tarafından Nick Coghlan's avatar Nick Coghlan

Merged revisions 66144 via svnmerge from

svn+ssh://pythondev@svn.python.org/python/trunk

........
  r66144 | nick.coghlan | 2008-09-02 20:14:47 +1000 (Tue, 02 Sep 2008) | 1 line

  Issue 3747: Fix caching in ABCMeta.__subclasscheck__ (R: Georg Brandl)
........
üst 40779859
...@@ -159,12 +159,12 @@ class ABCMeta(type): ...@@ -159,12 +159,12 @@ class ABCMeta(type):
# Check if it's a subclass of a registered class (recursive) # Check if it's a subclass of a registered class (recursive)
for rcls in cls._abc_registry: for rcls in cls._abc_registry:
if issubclass(subclass, rcls): if issubclass(subclass, rcls):
cls._abc_registry.add(subclass) cls._abc_cache.add(subclass)
return True return True
# Check if it's a subclass of a subclass (recursive) # Check if it's a subclass of a subclass (recursive)
for scls in cls.__subclasses__(): for scls in cls.__subclasses__():
if issubclass(subclass, scls): if issubclass(subclass, scls):
cls._abc_registry.add(subclass) cls._abc_cache.add(subclass)
return True return True
# No dice; update negative cache # No dice; update negative cache
cls._abc_negative_cache.add(subclass) cls._abc_negative_cache.add(subclass)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment