From ef391ac982400f3917037bfaa3a590dc3d61eeb4 Mon Sep 17 00:00:00 2001 From: Eli Bendersky Date: Sat, 21 Jul 2012 20:28:46 +0300 Subject: Raise ImportError if pyexpat's version is incompatible --- Modules/_elementtree.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Modules/_elementtree.c b/Modules/_elementtree.c index d734c26..c36af5d 100644 --- a/Modules/_elementtree.c +++ b/Modules/_elementtree.c @@ -3114,11 +3114,14 @@ PyInit__elementtree(void) expat_capi->size < sizeof(struct PyExpat_CAPI) || expat_capi->MAJOR_VERSION != XML_MAJOR_VERSION || expat_capi->MINOR_VERSION != XML_MINOR_VERSION || - expat_capi->MICRO_VERSION != XML_MICRO_VERSION) - expat_capi = NULL; - } - if (!expat_capi) + expat_capi->MICRO_VERSION != XML_MICRO_VERSION) { + PyErr_SetString(PyExc_ImportError, + "pyexpat version is incompatible"); + return NULL; + } + } else { return NULL; + } #endif elementtree_parseerror_obj = PyErr_NewException( -- cgit v0.12