Comment 1 for bug 1706256

Revision history for this message
scoder (scoder) wrote :

Yes, a lovely one. Thanks for sharing. ;)

The reason is in ABCMeta.__new__():

        abstracts = {name
                     for name, value in namespace.items()
                     if getattr(value, "__isabstractmethod__", False)}

Calling getattr() on the ElementMaker will not raise an AttributeError, but return a partial(ElementMaker) that creates "__isabstractmethod__" tags. That partial object resolves to true in the code abode and ABCMeta considers that enough to assume it's an actual abstract method. :)

I'd rather not restrict the (valid) tag names that ElementMaker is allowed to create - imagine a user wants to write an XML serialiser for Python class definitions. That could actually benefit from an XML tag name "__isabstractmethod__".

In short - I'm not sure if this is worth fixing. What do you think?