From 45031dfd1c37fca6361e881d56f4e62f800af91a Mon Sep 17 00:00:00 2001 From: Christian Heimes Date: Fri, 30 Nov 2007 15:13:13 +0000 Subject: Backmerge -r59233:59232 Guido said: Please roll this back. The error message you added is inappropriate when the parameter to a legitimate register() call is omitted, e.g. collections.Sequence.register() --- Lib/abc.py | 5 +---- Lib/test/test_abc.py | 7 ------- 2 files changed, 1 insertion(+), 11 deletions(-) diff --git a/Lib/abc.py b/Lib/abc.py index 30bb6b0..54dc8e2 100644 --- a/Lib/abc.py +++ b/Lib/abc.py @@ -137,11 +137,8 @@ class ABCMeta(type): cls._abc_negative_cache_version = ABCMeta._abc_invalidation_counter return cls - def register(cls, subclass=None): + def register(cls, subclass): """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): diff --git a/Lib/test/test_abc.py b/Lib/test/test_abc.py index a04b271..e6c8415 100644 --- a/Lib/test/test_abc.py +++ b/Lib/test/test_abc.py @@ -146,13 +146,6 @@ class TestABC(unittest.TestCase): C() self.assertEqual(B.counter, 1) - def test_error_on_subclass(self): - class A(abc.ABCMeta): - pass - class B: - pass - self.assertRaises(TypeError, A.register, B) - def test_main(): test_support.run_unittest(TestABC) -- cgit v0.12