summaryrefslogtreecommitdiffstats
path: root/Lib/abc.py
diff options
context:
space:
mode:
authorChristian Heimes <christian@cheimes.de>2007-11-30 14:32:41 (GMT)
committerChristian Heimes <christian@cheimes.de>2007-11-30 14:32:41 (GMT)
commit2e510fb9202977d93cc364e0c661769ea4a8cbbc (patch)
tree7d109639c031eae4f5c177e7ea5371c5e0737fa6 /Lib/abc.py
parentc8967002353864e012567125d7824abaeeb31dd3 (diff)
downloadcpython-2e510fb9202977d93cc364e0c661769ea4a8cbbc.zip
cpython-2e510fb9202977d93cc364e0c661769ea4a8cbbc.tar.gz
cpython-2e510fb9202977d93cc364e0c661769ea4a8cbbc.tar.bz2
Fix for bug #1109
Warning required when calling register() on an ABCMeta subclass.
Diffstat (limited to 'Lib/abc.py')
-rw-r--r--Lib/abc.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/abc.py b/Lib/abc.py
index 54dc8e2..30bb6b0 100644
--- a/Lib/abc.py
+++ b/Lib/abc.py
@@ -137,8 +137,11 @@ class ABCMeta(type):
cls._abc_negative_cache_version = ABCMeta._abc_invalidation_counter
return cls
- def register(cls, subclass):
+ def register(cls, subclass=None):
"""Register a virtual subclass of an ABC."""
+ if subclass is None:
+ raise TypeError("register() cannot be called on an ABCMeta "
+ "subclass, use class Example(metaclass=abc.ABCMeta) instead.")
if not isinstance(cls, type):
raise TypeError("Can only register classes")
if issubclass(subclass, cls):