summaryrefslogtreecommitdiffstats
path: root/Modules/_elementtree.c
diff options
context:
space:
mode:
authorEli Bendersky <eliben@gmail.com>2012-07-21 17:28:46 (GMT)
committerEli Bendersky <eliben@gmail.com>2012-07-21 17:28:46 (GMT)
commitef391ac982400f3917037bfaa3a590dc3d61eeb4 (patch)
tree59ff89fa60361ec7e49c8071ea4b5c7b6c8d1e95 /Modules/_elementtree.c
parent6e571d699f681127fd789cf0db3d521565073682 (diff)
downloadcpython-ef391ac982400f3917037bfaa3a590dc3d61eeb4.zip
cpython-ef391ac982400f3917037bfaa3a590dc3d61eeb4.tar.gz
cpython-ef391ac982400f3917037bfaa3a590dc3d61eeb4.tar.bz2
Raise ImportError if pyexpat's version is incompatible
Diffstat (limited to 'Modules/_elementtree.c')
-rw-r--r--Modules/_elementtree.c11
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(