mirror of
https://github.com/python/cpython.git
synced 2025-10-05 06:31:48 +00:00
Merged revisions 78800 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r78800 | florent.xicluna | 2010-03-08 16:20:28 +0100 (lun, 08 mar 2010) | 2 lines #7624: Fix isinstance(foo(), collections.Callable) for old-style classes. ........
This commit is contained in:
parent
dbac168948
commit
d474f3a239
4 changed files with 62 additions and 11 deletions
|
@ -4,6 +4,11 @@
|
|||
"""Abstract Base Classes (ABCs) according to PEP 3119."""
|
||||
|
||||
|
||||
# Instance of old-style class
|
||||
class _C: pass
|
||||
_InstanceType = type(_C())
|
||||
|
||||
|
||||
def abstractmethod(funcobj):
|
||||
"""A decorator indicating abstract methods.
|
||||
|
||||
|
@ -124,6 +129,9 @@ class ABCMeta(type):
|
|||
if subclass in cls._abc_cache:
|
||||
return True
|
||||
subtype = type(instance)
|
||||
# Old-style instances
|
||||
if subtype is _InstanceType:
|
||||
subtype = subclass
|
||||
if subtype is subclass or subclass is None:
|
||||
if (cls._abc_negative_cache_version ==
|
||||
ABCMeta._abc_invalidation_counter and
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue