mirror of
https://github.com/python/cpython.git
synced 2025-11-11 14:44:57 +00:00
We're always building _elementtree with USE_PYEXPAT_CAPI, so the #ifdefs in
the code are unnecessary.
This commit is contained in:
parent
2e185e17ce
commit
20d4174b3d
1 changed files with 2 additions and 12 deletions
|
|
@ -58,9 +58,6 @@
|
||||||
/* Leave defined to include the expat-based XMLParser type */
|
/* Leave defined to include the expat-based XMLParser type */
|
||||||
#define USE_EXPAT
|
#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
|
/* An element can hold this many children without extra memory
|
||||||
allocations. */
|
allocations. */
|
||||||
#define STATIC_CHILDREN 4
|
#define STATIC_CHILDREN 4
|
||||||
|
|
@ -2248,14 +2245,9 @@ static PyTypeObject TreeBuilder_Type = {
|
||||||
#if defined(USE_EXPAT)
|
#if defined(USE_EXPAT)
|
||||||
|
|
||||||
#include "expat.h"
|
#include "expat.h"
|
||||||
|
|
||||||
#if defined(USE_PYEXPAT_CAPI)
|
|
||||||
#include "pyexpat.h"
|
#include "pyexpat.h"
|
||||||
static struct PyExpat_CAPI* expat_capi;
|
static struct PyExpat_CAPI *expat_capi;
|
||||||
#define EXPAT(func) (expat_capi->func)
|
#define EXPAT(func) (expat_capi->func)
|
||||||
#else
|
|
||||||
#define EXPAT(func) (XML_##func)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static XML_Memory_Handling_Suite ExpatMemoryHandler = {
|
static XML_Memory_Handling_Suite ExpatMemoryHandler = {
|
||||||
PyObject_Malloc, PyObject_Realloc, PyObject_Free};
|
PyObject_Malloc, PyObject_Realloc, PyObject_Free};
|
||||||
|
|
@ -3223,8 +3215,7 @@ PyInit__elementtree(void)
|
||||||
elementtree_iter_obj = PyDict_GetItemString(g, "iter");
|
elementtree_iter_obj = PyDict_GetItemString(g, "iter");
|
||||||
elementtree_itertext_obj = PyDict_GetItemString(g, "itertext");
|
elementtree_itertext_obj = PyDict_GetItemString(g, "itertext");
|
||||||
|
|
||||||
#if defined(USE_PYEXPAT_CAPI)
|
/* link against pyexpat */
|
||||||
/* link against pyexpat, if possible */
|
|
||||||
expat_capi = PyCapsule_Import(PyExpat_CAPSULE_NAME, 0);
|
expat_capi = PyCapsule_Import(PyExpat_CAPSULE_NAME, 0);
|
||||||
if (expat_capi) {
|
if (expat_capi) {
|
||||||
/* check that it's usable */
|
/* check that it's usable */
|
||||||
|
|
@ -3242,7 +3233,6 @@ PyInit__elementtree(void)
|
||||||
);
|
);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
elementtree_parseerror_obj = PyErr_NewException(
|
elementtree_parseerror_obj = PyErr_NewException(
|
||||||
"xml.etree.ElementTree.ParseError", PyExc_SyntaxError, NULL
|
"xml.etree.ElementTree.ParseError", PyExc_SyntaxError, NULL
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue