Description: defusedxml.cElementTree results in an
 xml.etree.(c)ElementTree.ElementTree, which resulted
 False in the former expression, but should be True.
 This implementation inspects whether the actual tree object
 has an iter method.
Author: Arjan Keeman <akeeman@users.noreply.github.com>
Last-Update: 2020-01-17
Source: https://github.com/python-excel/xlrd/commit/eb161a9207e4ee471f32bda52cae420145cf1441.patch

`defusedxml.cElementTree results` in an `xml.etree.(c)ElementTree.ElementTree`, which resulted `False` in the former expression, but should be `True`. This implementation inspects whether the actual tree object has an `iter` method.
---
 xlrd/xlsx.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/xlrd/xlsx.py b/xlrd/xlsx.py
index f8ae8d3..d0e37dc 100644
--- a/xlrd/xlsx.py
+++ b/xlrd/xlsx.py
@@ -56,7 +56,7 @@ def ensure_elementtree_imported(verbosity, logfile):
             ET_has_iterparse = True
         except NotImplementedError:
             pass
-    Element_has_iter = hasattr(ET, 'ElementTree') and hasattr(ET.ElementTree, 'iter')
+    Element_has_iter = hasattr(ET.parse(BYTES_IO(b'<xml></xml>')), 'iter')
     if verbosity:
         etree_version = repr([
             (item, getattr(ET, item))
