mirror of
https://github.com/python/cpython.git
synced 2025-11-25 21:11:09 +00:00
Issue 3747: Fix caching in ABCMeta.__subclasscheck__ (R: Georg Brandl)
This commit is contained in:
parent
0792cbf5e1
commit
91ae3ea2b4
1 changed files with 2 additions and 2 deletions
|
|
@ -159,12 +159,12 @@ class ABCMeta(type):
|
|||
# Check if it's a subclass of a registered class (recursive)
|
||||
for rcls in cls._abc_registry:
|
||||
if issubclass(subclass, rcls):
|
||||
cls._abc_registry.add(subclass)
|
||||
cls._abc_cache.add(subclass)
|
||||
return True
|
||||
# Check if it's a subclass of a subclass (recursive)
|
||||
for scls in cls.__subclasses__():
|
||||
if issubclass(subclass, scls):
|
||||
cls._abc_registry.add(subclass)
|
||||
cls._abc_cache.add(subclass)
|
||||
return True
|
||||
# No dice; update negative cache
|
||||
cls._abc_negative_cache.add(subclass)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue