[Python-checkins] cpython (merge 3.2 -> default): Raise ImportError if pyexpat's version is incompatible

eli.bendersky python-checkins at python.org
Sat Jul 21 19:33:17 CEST 2012


http://hg.python.org/cpython/rev/4b232f6d2ea3
changeset:   78221:4b232f6d2ea3
parent:      78219:295b715b6875
parent:      78220:c8534d55c5e6
user:        Eli Bendersky <eliben at gmail.com>
date:        Sat Jul 21 20:32:39 2012 +0300
summary:
  Raise ImportError if pyexpat's version is incompatible

files:
  Modules/_elementtree.c |  8 +++++---
  1 files changed, 5 insertions(+), 3 deletions(-)


diff --git a/Modules/_elementtree.c b/Modules/_elementtree.c
--- a/Modules/_elementtree.c
+++ b/Modules/_elementtree.c
@@ -3511,11 +3511,13 @@
             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;
         }
+    } else {
+        return NULL;
     }
-    if (!expat_capi)
-        return NULL;
 
     elementtree_parseerror_obj = PyErr_NewException(
         "xml.etree.ElementTree.ParseError", PyExc_SyntaxError, NULL

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list