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

Skip to content

Commit 7b31b1a

Browse files
committed
Raise ImportError if pyexpat's version is incompatible
2 parents 2731c04 + ef391ac commit 7b31b1a

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

Modules/_elementtree.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3511,11 +3511,13 @@ PyInit__elementtree(void)
35113511
expat_capi->MAJOR_VERSION != XML_MAJOR_VERSION ||
35123512
expat_capi->MINOR_VERSION != XML_MINOR_VERSION ||
35133513
expat_capi->MICRO_VERSION != XML_MICRO_VERSION) {
3514-
expat_capi = NULL;
3514+
PyErr_SetString(PyExc_ImportError,
3515+
"pyexpat version is incompatible");
3516+
return NULL;
35153517
}
3516-
}
3517-
if (!expat_capi)
3518+
} else {
35183519
return NULL;
3520+
}
35193521

35203522
elementtree_parseerror_obj = PyErr_NewException(
35213523
"xml.etree.ElementTree.ParseError", PyExc_SyntaxError, NULL

0 commit comments

Comments
 (0)