summaryrefslogtreecommitdiff
path: root/defusedxml/common.py
diff options
context:
space:
mode:
Diffstat (limited to 'defusedxml/common.py')
-rw-r--r--defusedxml/common.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/defusedxml/common.py b/defusedxml/common.py
index be23e97..1995d61 100644
--- a/defusedxml/common.py
+++ b/defusedxml/common.py
@@ -6,9 +6,14 @@
"""Common constants, exceptions and helpe functions
"""
import sys
+import xml.parsers.expat
PY3 = sys.version_info[0] == 3
+# Fail early when pyexpat is not installed correctly
+if not hasattr(xml.parsers.expat, "ParserCreate"):
+ raise ImportError('pyexpat')
+
class DefusedXmlException(ValueError):
"""Base exception