Daniel Urban <urban.dani...@gmail.com> added the comment: If we create a new class, which is a metaclass, and also inherits an ABC, we create a new instance of ABCMeta.
When ABCMeta.__new__ creates the __abstractmethods__ attribute of the new class, it iterates over the __abstractmethods__ attribute of every base class (and checks every name in it, if it's abstract in the new class). One of the base classes of a metaclass is of course type. The type.__abstractmethods__ object is a getset descriptor (its __set__ switches some flags in tp_flags), which isn't iterable, so it raises the exception. Ideas for possible solutions: 1. In ABCMeta.__new__ special case type (do not check its __abstractmethods__attribute). 2. In ABCMeta.__new__ check if the __abstractmethods__ attribute is in fact an iterable, before we try to iterate over it. (I don't think this would be a very good solution, because if a base class' __abstractmethods__ isn't iterable, it should be an error, except if the base class is type itself. So we should special case type anyway.) I can't come up with a use case for this right now, but I don't see why it shouldn't work. ---------- components: +Library (Lib) _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue9533> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com