diff --git a/Modules/_elementtree.c b/Modules/_elementtree.c index 788772113c4..d734c2637a9 100644 --- a/Modules/_elementtree.c +++ b/Modules/_elementtree.c @@ -3117,6 +3117,8 @@ PyInit__elementtree(void) expat_capi->MICRO_VERSION != XML_MICRO_VERSION) expat_capi = NULL; } + if (!expat_capi) + return NULL; #endif elementtree_parseerror_obj = PyErr_NewException(