Raise ImportError if pyexpat's version is incompatible

This commit is contained in:
Eli Bendersky 2012-07-21 20:28:46 +03:00
parent 6e571d699f
commit ef391ac982
1 changed files with 7 additions and 4 deletions

View File

@ -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(