diff options
Diffstat (limited to 'Modules/_elementtree.c')
-rw-r--r-- | Modules/_elementtree.c | 60 |
1 files changed, 6 insertions, 54 deletions
diff --git a/Modules/_elementtree.c b/Modules/_elementtree.c index 9caef99..7c8f5d5 100644 --- a/Modules/_elementtree.c +++ b/Modules/_elementtree.c @@ -1,63 +1,22 @@ -/* - * ElementTree - * $Id: _elementtree.c 3473 2009-01-11 22:53:55Z fredrik $ - * - * elementtree accelerator - * - * History: - * 1999-06-20 fl created (as part of sgmlop) - * 2001-05-29 fl effdom edition - * 2003-02-27 fl elementtree edition (alpha) - * 2004-06-03 fl updates for elementtree 1.2 - * 2005-01-05 fl major optimization effort - * 2005-01-11 fl first public release (cElementTree 0.8) - * 2005-01-12 fl split element object into base and extras - * 2005-01-13 fl use tagged pointers for tail/text (cElementTree 0.9) - * 2005-01-17 fl added treebuilder close method - * 2005-01-17 fl fixed crash in getchildren - * 2005-01-18 fl removed observer api, added iterparse (cElementTree 0.9.3) - * 2005-01-23 fl revised iterparse api; added namespace event support (0.9.8) - * 2005-01-26 fl added VERSION module property (cElementTree 1.0) - * 2005-01-28 fl added remove method (1.0.1) - * 2005-03-01 fl added iselement function; fixed makeelement aliasing (1.0.2) - * 2005-03-13 fl export Comment and ProcessingInstruction/PI helpers - * 2005-03-26 fl added Comment and PI support to XMLParser - * 2005-03-27 fl event optimizations; complain about bogus events - * 2005-08-08 fl fixed read error handling in parse - * 2005-08-11 fl added runtime test for copy workaround (1.0.3) - * 2005-12-13 fl added expat_capi support (for xml.etree) (1.0.4) - * 2005-12-16 fl added support for non-standard encodings - * 2006-03-08 fl fixed a couple of potential null-refs and leaks - * 2006-03-12 fl merge in 2.5 ssize_t changes - * 2007-08-25 fl call custom builder's close method from XMLParser - * 2007-08-31 fl added iter, extend from ET 1.3 - * 2007-09-01 fl fixed ParseError exception, setslice source type, etc - * 2007-09-03 fl fixed handling of negative insert indexes - * 2007-09-04 fl added itertext from ET 1.3 - * 2007-09-06 fl added position attribute to ParseError exception - * 2008-06-06 fl delay error reporting in iterparse (from Hrvoje Niksic) +/*-------------------------------------------------------------------- + * Licensed to PSF under a Contributor Agreement. + * See http://www.python.org/psf/license for licensing details. * + * _elementtree - C accelerator for xml.etree.ElementTree * Copyright (c) 1999-2009 by Secret Labs AB. All rights reserved. * Copyright (c) 1999-2009 by Fredrik Lundh. * * info@pythonware.com * http://www.pythonware.com + *-------------------------------------------------------------------- */ -/* Licensed to PSF under a Contributor Agreement. */ -/* See http://www.python.org/psf/license for licensing details. */ - #include "Python.h" #include "structmember.h" -#define VERSION "1.0.6" - /* -------------------------------------------------------------------- */ /* configuration */ -/* Leave defined to include the expat-based XMLParser type */ -#define USE_EXPAT - /* An element can hold this many children without extra memory allocations. */ #define STATIC_CHILDREN 4 @@ -340,6 +299,7 @@ get_attrib_from_keywords(PyObject *kwds) Py_DECREF(attrib_str); + /* attrib can be NULL if PyDict_New failed */ if (attrib) PyDict_Update(attrib, kwds); return attrib; @@ -2685,8 +2645,6 @@ static PyTypeObject TreeBuilder_Type = { /* ==================================================================== */ /* the expat interface */ -#if defined(USE_EXPAT) - #include "expat.h" #include "pyexpat.h" static struct PyExpat_CAPI *expat_capi; @@ -3644,8 +3602,6 @@ static PyTypeObject XMLParser_Type = { 0, /* tp_free */ }; -#endif - /* ==================================================================== */ /* python module interface */ @@ -3677,10 +3633,8 @@ PyInit__elementtree(void) return NULL; if (PyType_Ready(&Element_Type) < 0) return NULL; -#if defined(USE_EXPAT) if (PyType_Ready(&XMLParser_Type) < 0) return NULL; -#endif m = PyModule_Create(&_elementtreemodule); if (!m) @@ -3723,10 +3677,8 @@ PyInit__elementtree(void) Py_INCREF((PyObject *)&TreeBuilder_Type); PyModule_AddObject(m, "TreeBuilder", (PyObject *)&TreeBuilder_Type); -#if defined(USE_EXPAT) Py_INCREF((PyObject *)&XMLParser_Type); PyModule_AddObject(m, "XMLParser", (PyObject *)&XMLParser_Type); -#endif return m; } |