diff options
author | Florent Xicluna <florent.xicluna@gmail.com> | 2010-03-08 15:20:28 (GMT) |
---|---|---|
committer | Florent Xicluna <florent.xicluna@gmail.com> | 2010-03-08 15:20:28 (GMT) |
commit | 47627d51644d3fcc57390455ef845f72e6387485 (patch) | |
tree | 18cc9f986951d458645b12178436b4be1529f8b9 /Lib/abc.py | |
parent | 6f682be82b4ce2c64590fdc1255bd0b82d33b0f0 (diff) | |
download | cpython-47627d51644d3fcc57390455ef845f72e6387485.zip cpython-47627d51644d3fcc57390455ef845f72e6387485.tar.gz cpython-47627d51644d3fcc57390455ef845f72e6387485.tar.bz2 |
#7624: Fix isinstance(foo(), collections.Callable) for old-style classes.
Diffstat (limited to 'Lib/abc.py')
-rw-r--r-- | Lib/abc.py | 8 |
1 files changed, 8 insertions, 0 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 |