summaryrefslogtreecommitdiff
path: root/Lib/abc.py
diff options
context:
space:
mode:
authorFlorent Xicluna <florent.xicluna@gmail.com>2010-03-23 12:37:29 +0000
committerFlorent Xicluna <florent.xicluna@gmail.com>2010-03-23 12:37:29 +0000
commitd474f3a23953d55a34588c75cfc2641c4d0da81b (patch)
treebcbc6c546570fd28988ab9ded2d1e3389eb2cbc2 /Lib/abc.py
parentdbac1689483ec160bb811792f5a70e09fefd55ec (diff)
downloadcpython-git-d474f3a23953d55a34588c75cfc2641c4d0da81b.tar.gz
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. ........
Diffstat (limited to 'Lib/abc.py')
-rw-r--r--Lib/abc.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/abc.py b/Lib/abc.py
index 95126d8a18..681c753215 100644
--- a/Lib/abc.py
+++ b/Lib/abc.py
@@ -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