diff options
author | Eli Bendersky <eliben@gmail.com> | 2012-07-21 17:28:46 (GMT) |
---|---|---|
committer | Eli Bendersky <eliben@gmail.com> | 2012-07-21 17:28:46 (GMT) |
commit | ef391ac982400f3917037bfaa3a590dc3d61eeb4 (patch) | |
tree | 59ff89fa60361ec7e49c8071ea4b5c7b6c8d1e95 | |
parent | 6e571d699f681127fd789cf0db3d521565073682 (diff) | |
download | cpython-ef391ac982400f3917037bfaa3a590dc3d61eeb4.zip cpython-ef391ac982400f3917037bfaa3a590dc3d61eeb4.tar.gz cpython-ef391ac982400f3917037bfaa3a590dc3d61eeb4.tar.bz2 |
Raise ImportError if pyexpat's version is incompatible
-rw-r--r-- | Modules/_elementtree.c | 11 |
1 files 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( |