Package: python3-xlrd
Version: 1.2.0-1
Tags: patch
xlrd 1.2.0 started using defusedxml if available.
As defusedxml.cElementTree does not have a top-level ElementTree
attribute, Element_has_iter gets set to False
(https://sources.debian.org/src/python-xlrd/1.2.0-1/xlrd/xlsx.py/#L59).
However, ET.parse returns a standard library ElementTree, which does
have iter and not getiterator. This causes the error:
E AttributeError: 'ElementTree' object has no attribute 'getiterator'
/usr/lib/python3/dist-packages/xlrd/xlsx.py:266: AttributeError
This shows up in the pandas autopkgtest, as python3-pandas
recommends/test-depends on python3-odf and hence python3-defusedxml.
Untested fix:
--- /usr/lib/python3/dist-packages/xlrd/xlsx.py.old 2020-12-05
22:07:52.009976382 +0000
+++ /usr/lib/python3/dist-packages/xlrd/xlsx.py 2020-12-05
22:13:19.330486195 +0000
@@ -56,7 +56,7 @@ def ensure_elementtree_imported(verbosit
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'<data></data>')),
'iter')
if verbosity:
etree_version = repr([
(item, getattr(ET, item))
Known upstream as https://github.com/python-excel/xlrd/pull/360, which
suggests basically the same fix.