summaryrefslogtreecommitdiff
path: root/defusedxml/cElementTree.py
diff options
context:
space:
mode:
authorChristian Heimes <christian@python.org>2020-04-03 16:45:18 +0200
committerChristian Heimes <christian@python.org>2020-04-15 14:06:08 +0200
commit4339aeea22a90eb48cf2558beaae20ad06e28fbb (patch)
treef0df47554e6e66cc6fbb142bd4bc182672d0ee41 /defusedxml/cElementTree.py
parentf8e3fe87aee928224378acee5761df3ca6d95dd2 (diff)
downloaddefusedxml-git-4339aeea22a90eb48cf2558beaae20ad06e28fbb.tar.gz
Python 3.9 compatibility
Python 3.9 no longer ships the xml.etree.cElementTree module. defusedxml no longer provides the a fixed module with 3.9 as well. defusedxml.cElementTree is still available with 3.8. See: https://bugs.python.org/issue36543 See: https://github.com/python/cpython/pull/19108 Fixes: https://github.com/tiran/defusedxml/issues/50 Signed-off-by: Christian Heimes <christian@python.org>
Diffstat (limited to 'defusedxml/cElementTree.py')
-rw-r--r--defusedxml/cElementTree.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/defusedxml/cElementTree.py b/defusedxml/cElementTree.py
index fdc761e..95c3056 100644
--- a/defusedxml/cElementTree.py
+++ b/defusedxml/cElementTree.py
@@ -7,6 +7,11 @@
"""
from __future__ import absolute_import
+from .common import _generate_etree_functions, _HAVE_CELEMENTTREE
+
+if not _HAVE_CELEMENTTREE:
+ raise ImportError("cElementTree has been removed from Python 3.9")
+
from xml.etree.cElementTree import TreeBuilder as _TreeBuilder
from xml.etree.cElementTree import parse as _parse
from xml.etree.cElementTree import tostring
@@ -15,7 +20,6 @@ from xml.etree.cElementTree import tostring
from xml.etree.ElementTree import iterparse as _iterparse
from .ElementTree import DefusedXMLParser
-from .common import _generate_etree_functions
__origin__ = "xml.etree.cElementTree"