Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ef391ac

Browse files
committed
Raise ImportError if pyexpat's version is incompatible
1 parent 6e571d6 commit ef391ac

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

Modules/_elementtree.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3114,11 +3114,14 @@ PyInit__elementtree(void)
31143114
expat_capi->size < sizeof(struct PyExpat_CAPI) ||
31153115
expat_capi->MAJOR_VERSION != XML_MAJOR_VERSION ||
31163116
expat_capi->MINOR_VERSION != XML_MINOR_VERSION ||
3117-
expat_capi->MICRO_VERSION != XML_MICRO_VERSION)
3118-
expat_capi = NULL;
3119-
}
3120-
if (!expat_capi)
3117+
expat_capi->MICRO_VERSION != XML_MICRO_VERSION) {
3118+
PyErr_SetString(PyExc_ImportError,
3119+
"pyexpat version is incompatible");
3120+
return NULL;
3121+
}
3122+
} else {
31213123
return NULL;
3124+
}
31223125
#endif
31233126

31243127
elementtree_parseerror_obj = PyErr_NewException(

0 commit comments

Comments
 (0)