Issue #16089: Allow ElementTree.TreeBuilder to work again with a non-Element element_factory (fixes a regression in SimpleTAL).

This commit is contained in:
Antoine Pitrou 2012-10-04 19:53:29 +02:00
parent 3934b61a16
commit ee329318db
4 changed files with 127 additions and 31 deletions

View file

@ -303,7 +303,9 @@ class Element:
self._children.insert(index, element)
def _assert_is_element(self, e):
if not isinstance(e, Element):
# Need to refer to the actual Python implementation, not the
# shadowing C implementation.
if not isinstance(e, _Element):
raise TypeError('expected an Element, not %s' % type(e).__name__)
##