[Python-checkins] r85182 - in python/branches/py3k: Lib/test/test_abc.py Misc/NEWS

benjamin.peterson python-checkins at python.org
Sat Oct 2 19:55:48 CEST 2010


Author: benjamin.peterson
Date: Sat Oct  2 19:55:47 2010
New Revision: 85182

Log:
add a test and a note about metaclasses now being abcs

Modified:
   python/branches/py3k/Lib/test/test_abc.py
   python/branches/py3k/Misc/NEWS

Modified: python/branches/py3k/Lib/test/test_abc.py
==============================================================================
--- python/branches/py3k/Lib/test/test_abc.py	(original)
+++ python/branches/py3k/Lib/test/test_abc.py	Sat Oct  2 19:55:47 2010
@@ -105,6 +105,19 @@
             pass
         self.assertRaises(AttributeError, getattr, meta, "__abstractmethods__")
 
+    def test_metaclass_abc(self):
+        # Metaclasses can be ABCs, too.
+        class A(metaclass=abc.ABCMeta):
+            @abc.abstractmethod
+            def x(self):
+                pass
+        self.assertEqual(A.__abstractmethods__, {"x"})
+        class meta(type, A):
+            def x(self):
+                return 1
+        class C(metaclass=meta):
+            pass
+
     def test_registration_basics(self):
         class A(metaclass=abc.ABCMeta):
             pass

Modified: python/branches/py3k/Misc/NEWS
==============================================================================
--- python/branches/py3k/Misc/NEWS	(original)
+++ python/branches/py3k/Misc/NEWS	Sat Oct  2 19:55:47 2010
@@ -10,14 +10,15 @@
 Core and Builtins
 -----------------
 
+- Issue #10006: type.__abstractmethods__ now raises an AttributeError.  As a
+  result metaclasses can now be ABCs (see #9533).
+
 - Issue #8670: ctypes.c_wchar supports non-BMP characters with 32 bits wchar_t.
 
 - Issue #8670: PyUnicode_AsWideChar() and PyUnicode_AsWideCharString() replace
   UTF-16 surrogate pairs by single non-BMP characters for 16 bits Py_UNICODE
   and 32 bits wchar_t (eg. Linux in narrow build).
 
-- Issue #10006: type.__abstractmethods__ now raises an AttributeError.
-
 - Issue #10003: Allow handling of SIGBREAK on Windows. Fixes a regression
   introduced by issue #9324.
 


More information about the Python-checkins mailing list