summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_elementtree.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/Modules/_elementtree.c b/Modules/_elementtree.c
index a7201a5..6f17d80 100644
--- a/Modules/_elementtree.c
+++ b/Modules/_elementtree.c
@@ -3511,11 +3511,13 @@ PyInit__elementtree(void)
expat_capi->MAJOR_VERSION != XML_MAJOR_VERSION ||
expat_capi->MINOR_VERSION != XML_MINOR_VERSION ||
expat_capi->MICRO_VERSION != XML_MICRO_VERSION) {
- expat_capi = NULL;
+ PyErr_SetString(PyExc_ImportError,
+ "pyexpat version is incompatible");
+ return NULL;
}
- }
- if (!expat_capi)
+ } else {
return NULL;
+ }
elementtree_parseerror_obj = PyErr_NewException(
"xml.etree.ElementTree.ParseError", PyExc_SyntaxError, NULL