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?
Yes, a lovely one. Thanks for sharing. ;)
The reason is in ABCMeta.__new__():
abstracts = {name
for name, value in namespace.items()
if getattr(value, "__isabstractme thod__" , False)}
Calling getattr() on the ElementMaker will not raise an AttributeError, but return a partial( ElementMaker) that creates "__isabstractme thod__" 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 "__isabstractme thod__" .
In short - I'm not sure if this is worth fixing. What do you think?