From 91b8eeae560becdd8f1f135ead9ab6082ddf4ba4 Mon Sep 17 00:00:00 2001 From: Antoine Pitrou Date: Thu, 4 Oct 2012 19:53:29 +0200 Subject: Issue #16089: Allow ElementTree.TreeBuilder to work again with a non-Element element_factory (fixes a regression in SimpleTAL). --- Lib/xml/etree/ElementTree.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'Lib/xml') diff --git a/Lib/xml/etree/ElementTree.py b/Lib/xml/etree/ElementTree.py index b9d8df6ab9..9553c51f6c 100644 --- a/Lib/xml/etree/ElementTree.py +++ b/Lib/xml/etree/ElementTree.py @@ -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__) ## -- cgit v1.2.1