You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Node(...):
...
ownerDocument = None
...
Element(Node):
\_\_slots__=('ownerDocument', ...)
...
\~\~\~
As Element declares an ownerDocument attribute in \_\_slots__, Node's ownerDocument attribute is hidden:
class B: b=1;
class D(B): __slots__={'b'}
D().b -> AttributeError
~~~
This leads to a strange behaviour were accessing a base attribute fails with an attribute error.
Should the Node.ownerDocument attribute not be removed?
Or its name removed from the Element.__slots__ list?
Ie have the attribute in the base or the derivative, but not both.
When inheriting from a class without __slots__ [Node], the __dict__ attribute of that class will always be accessible, so a __slots__ definition in the subclass [Element] is meaningless.
So as for as I understand Element.__slots__ does not reduce the Element() footprint (it was introduced for that).
It looks like the __slots__ declaration on Node was missed when the other slots changes were made (by MvL in 3931f043b79a). Note that the Node base class (xml.dom.Node) has a __slots__ declaration, but it was added after MvL's patch (by Florent in 49c5511b234a).
Changing this now may have backward compatibility issues, though.
vapiermannequin
changed the title
xml.dom.minidom.Element.ownerDocument is hiden
xml.dom.minidom.Element.ownerDocument is hidden
Nov 13, 2020
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: