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

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


http://hg.python.org/cpython/rev/c8534d55c5e6
changeset:   78220:c8534d55c5e6
branch:      3.2
parent:      78214:29642f82bbcc
user:        Eli Bendersky <eliben at gmail.com>
date:        Sat Jul 21 20:28:46 2012 +0300
summary:
  Raise ImportError if pyexpat's version is incompatible

files:
  Modules/_elementtree.c |  11 +++++++----
  1 files changed, 7 insertions(+), 4 deletions(-)


diff --git a/Modules/_elementtree.c b/Modules/_elementtree.c
--- a/Modules/_elementtree.c
+++ b/Modules/_elementtree.c
@@ -3114,11 +3114,14 @@
             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;
+            expat_capi->MICRO_VERSION != XML_MICRO_VERSION) {
+            PyErr_SetString(PyExc_ImportError,
+                            "pyexpat version is incompatible");
+            return NULL;
+        }
+    } else {
+        return NULL;
     }
-    if (!expat_capi)
-        return NULL;
 #endif
 
     elementtree_parseerror_obj = PyErr_NewException(

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


More information about the Python-checkins mailing list