summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Bendersky <eliben@gmail.com>2012-07-21 17:32:39 (GMT)
committerEli Bendersky <eliben@gmail.com>2012-07-21 17:32:39 (GMT)
commit7b31b1a2a405ac7273e90a4110c0b7c79acbeb53 (patch)
tree7c24b2506737a823e7ffdf8cae64f29d8411223f
parent2731c049ac836aef0c57129eef2e23114f6d040c (diff)
parentef391ac982400f3917037bfaa3a590dc3d61eeb4 (diff)
downloadcpython-7b31b1a2a405ac7273e90a4110c0b7c79acbeb53.zip
cpython-7b31b1a2a405ac7273e90a4110c0b7c79acbeb53.tar.gz
cpython-7b31b1a2a405ac7273e90a4110c0b7c79acbeb53.tar.bz2
Raise ImportError if pyexpat's version is incompatible
-rw-r--r--Modules/_elementtree.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/Modules/_elementtree.c b/Modules/_elementtree.c
index a7201a5..6f17d80 100644
--- a/Modules/_elementtree.c
+++ b/Modules/_elementtree.c
@@ -3511,11 +3511,13 @@ PyInit__elementtree(void)
expat_capi->MAJOR_VERSION != XML_MAJOR_VERSION ||
expat_capi->MINOR_VERSION != XML_MINOR_VERSION ||
expat_capi->MICRO_VERSION != XML_MICRO_VERSION) {
- expat_capi = NULL;
+ PyErr_SetString(PyExc_ImportError,
+ "pyexpat version is incompatible");
+ return NULL;
}
- }
- if (!expat_capi)
+ } else {
return NULL;
+ }
elementtree_parseerror_obj = PyErr_NewException(
"xml.etree.ElementTree.ParseError", PyExc_SyntaxError, NULL