[Python-checkins] cpython: We're always building _elementtree with USE_PYEXPAT_CAPI, so the #ifdefs in

eli.bendersky python-checkins at python.org
Fri Jun 1 08:50:27 CEST 2012


http://hg.python.org/cpython/rev/cf9c379a9859
changeset:   77278:cf9c379a9859
user:        Eli Bendersky <eliben at gmail.com>
date:        Fri Jun 01 09:48:37 2012 +0300
summary:
  We're always building _elementtree with USE_PYEXPAT_CAPI, so the #ifdefs in
the code are unnecessary.

files:
  Modules/_elementtree.c |  14 ++------------
  1 files changed, 2 insertions(+), 12 deletions(-)


diff --git a/Modules/_elementtree.c b/Modules/_elementtree.c
--- a/Modules/_elementtree.c
+++ b/Modules/_elementtree.c
@@ -58,9 +58,6 @@
 /* Leave defined to include the expat-based XMLParser type */
 #define USE_EXPAT
 
-/* Define to do all expat calls via pyexpat's embedded expat library */
-/* #define USE_PYEXPAT_CAPI */
-
 /* An element can hold this many children without extra memory
    allocations. */
 #define STATIC_CHILDREN 4
@@ -2248,14 +2245,9 @@
 #if defined(USE_EXPAT)
 
 #include "expat.h"
-
-#if defined(USE_PYEXPAT_CAPI)
 #include "pyexpat.h"
-static struct PyExpat_CAPI* expat_capi;
+static struct PyExpat_CAPI *expat_capi;
 #define EXPAT(func) (expat_capi->func)
-#else
-#define EXPAT(func) (XML_##func)
-#endif
 
 static XML_Memory_Handling_Suite ExpatMemoryHandler = {
     PyObject_Malloc, PyObject_Realloc, PyObject_Free};
@@ -3223,8 +3215,7 @@
     elementtree_iter_obj = PyDict_GetItemString(g, "iter");
     elementtree_itertext_obj = PyDict_GetItemString(g, "itertext");
 
-#if defined(USE_PYEXPAT_CAPI)
-    /* link against pyexpat, if possible */
+    /* link against pyexpat */
     expat_capi = PyCapsule_Import(PyExpat_CAPSULE_NAME, 0);
     if (expat_capi) {
         /* check that it's usable */
@@ -3242,7 +3233,6 @@
             );
         return NULL;
     }
-#endif
 
     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