lxml 5.3.2__cp312-cp312-win32.whl → 6.0.0__cp312-cp312-win32.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- lxml/__init__.py +1 -1
- lxml/_elementpath.cp312-win32.pyd +0 -0
- lxml/_elementpath.py +3 -1
- lxml/apihelpers.pxi +25 -17
- lxml/builder.cp312-win32.pyd +0 -0
- lxml/builder.py +11 -0
- lxml/debug.pxi +0 -54
- lxml/etree.cp312-win32.pyd +0 -0
- lxml/etree.h +244 -248
- lxml/etree.pyx +154 -33
- lxml/etree_api.h +204 -195
- lxml/extensions.pxi +3 -6
- lxml/html/__init__.py +7 -3
- lxml/html/_difflib.cp312-win32.pyd +0 -0
- lxml/html/_difflib.py +2106 -0
- lxml/html/builder.py +40 -0
- lxml/html/defs.py +3 -3
- lxml/html/diff.cp312-win32.pyd +0 -0
- lxml/html/diff.py +406 -312
- lxml/includes/etree_defs.h +6 -6
- lxml/includes/lxml-version.h +1 -1
- lxml/includes/tree.pxd +10 -12
- lxml/includes/xmlparser.pxd +46 -8
- lxml/lxml.etree.h +24 -28
- lxml/lxml.etree_api.h +59 -50
- lxml/objectify.cp312-win32.pyd +0 -0
- lxml/objectify.pyx +11 -7
- lxml/parser.pxi +106 -47
- lxml/sax.cp312-win32.pyd +0 -0
- lxml/sax.py +11 -0
- lxml/saxparser.pxi +14 -14
- lxml/schematron.pxi +8 -3
- lxml/serializer.pxi +71 -3
- lxml/xslt.pxi +10 -3
- lxml-6.0.0.dist-info/METADATA +163 -0
- {lxml-5.3.2.dist-info → lxml-6.0.0.dist-info}/RECORD +40 -38
- {lxml-5.3.2.dist-info → lxml-6.0.0.dist-info}/WHEEL +1 -1
- {lxml-5.3.2.dist-info → lxml-6.0.0.dist-info}/licenses/LICENSE.txt +3 -1
- lxml-5.3.2.dist-info/METADATA +0 -100
- {lxml-5.3.2.dist-info → lxml-6.0.0.dist-info}/licenses/LICENSES.txt +0 -0
- {lxml-5.3.2.dist-info → lxml-6.0.0.dist-info}/top_level.txt +0 -0
lxml/includes/etree_defs.h
CHANGED
@@ -159,6 +159,10 @@ static PyObject* PyBytes_FromFormat(const char* format, ...) {
|
|
159
159
|
# define xmlBufUse(buf) xmlBufferLength(buf)
|
160
160
|
#endif
|
161
161
|
|
162
|
+
#if LIBXML_VERSION < 21500
|
163
|
+
# define xmlCtxtIsStopped(p_ctxt) ((p_ctxt)->disableSAX != 0)
|
164
|
+
#endif
|
165
|
+
|
162
166
|
/* libexslt 1.1.25+ support EXSLT functions in XPath */
|
163
167
|
#if LIBXSLT_VERSION < 10125
|
164
168
|
#define exsltDateXpathCtxtRegister(ctxt, prefix)
|
@@ -177,7 +181,7 @@ long _ftol2( double dblSource ) { return _ftol( dblSource ); }
|
|
177
181
|
|
178
182
|
#ifdef __GNUC__
|
179
183
|
/* Test for GCC > 2.95 */
|
180
|
-
#if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))
|
184
|
+
#if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95))
|
181
185
|
#define unlikely_condition(x) __builtin_expect((x), 0)
|
182
186
|
#else /* __GNUC__ > 2 ... */
|
183
187
|
#define unlikely_condition(x) (x)
|
@@ -190,10 +194,6 @@ long _ftol2( double dblSource ) { return _ftol( dblSource ); }
|
|
190
194
|
#define Py_TYPE(ob) (((PyObject*)(ob))->ob_type)
|
191
195
|
#endif
|
192
196
|
|
193
|
-
#define PY_NEW(T) \
|
194
|
-
(((PyTypeObject*)(T))->tp_new( \
|
195
|
-
(PyTypeObject*)(T), __pyx_empty_tuple, NULL))
|
196
|
-
|
197
197
|
#define _fqtypename(o) ((Py_TYPE(o))->tp_name)
|
198
198
|
|
199
199
|
#define lxml_malloc(count, item_size) \
|
@@ -268,7 +268,7 @@ static void* lxml_unpack_xmldoc_capsule(PyObject* capsule, int* is_owned) {
|
|
268
268
|
* 'inclusive' is 1). The _ELEMENT_ variants will only stop on nodes
|
269
269
|
* that match _isElement(), the normal variant will stop on every node
|
270
270
|
* except text nodes.
|
271
|
-
*
|
271
|
+
*
|
272
272
|
* To traverse the node and all of its children and siblings in Pyrex, call
|
273
273
|
* cdef xmlNode* some_node
|
274
274
|
* BEGIN_FOR_EACH_ELEMENT_FROM(some_node.parent, some_node, 1)
|
lxml/includes/lxml-version.h
CHANGED
lxml/includes/tree.pxd
CHANGED
@@ -6,8 +6,9 @@ cdef extern from "lxml-version.h":
|
|
6
6
|
cdef char* LXML_VERSION_STRING
|
7
7
|
|
8
8
|
cdef extern from "libxml/xmlversion.h":
|
9
|
-
|
10
|
-
|
9
|
+
const char* xmlParserVersion
|
10
|
+
int LIBXML_VERSION
|
11
|
+
|
11
12
|
|
12
13
|
cdef extern from "libxml/xmlstring.h" nogil:
|
13
14
|
ctypedef unsigned char xmlChar
|
@@ -141,7 +142,7 @@ cdef extern from "libxml/tree.h" nogil:
|
|
141
142
|
XML_ATTRIBUTE_NMTOKENS= 8
|
142
143
|
XML_ATTRIBUTE_ENUMERATION= 9
|
143
144
|
XML_ATTRIBUTE_NOTATION= 10
|
144
|
-
|
145
|
+
|
145
146
|
ctypedef enum xmlAttributeDefault:
|
146
147
|
XML_ATTRIBUTE_NONE= 1
|
147
148
|
XML_ATTRIBUTE_REQUIRED= 2
|
@@ -288,7 +289,7 @@ cdef extern from "libxml/tree.h" nogil:
|
|
288
289
|
xmlDtd* intSubset
|
289
290
|
xmlDtd* extSubset
|
290
291
|
int properties
|
291
|
-
|
292
|
+
|
292
293
|
ctypedef struct xmlAttr:
|
293
294
|
void* _private
|
294
295
|
xmlElementType type
|
@@ -307,7 +308,7 @@ cdef extern from "libxml/tree.h" nogil:
|
|
307
308
|
const_xmlChar* name
|
308
309
|
xmlAttr* attr
|
309
310
|
xmlDoc* doc
|
310
|
-
|
311
|
+
|
311
312
|
ctypedef struct xmlBuffer
|
312
313
|
|
313
314
|
ctypedef struct xmlBuf # new in libxml2 2.9
|
@@ -318,14 +319,14 @@ cdef extern from "libxml/tree.h" nogil:
|
|
318
319
|
int error
|
319
320
|
|
320
321
|
const_xmlChar* XML_XML_NAMESPACE
|
321
|
-
|
322
|
+
|
322
323
|
cdef void xmlFreeDoc(xmlDoc* cur)
|
323
324
|
cdef void xmlFreeDtd(xmlDtd* cur)
|
324
325
|
cdef void xmlFreeNode(xmlNode* cur)
|
325
326
|
cdef void xmlFreeNsList(xmlNs* ns)
|
326
327
|
cdef void xmlFreeNs(xmlNs* ns)
|
327
328
|
cdef void xmlFree(void* buf)
|
328
|
-
|
329
|
+
|
329
330
|
cdef xmlNode* xmlNewNode(xmlNs* ns, const_xmlChar* name)
|
330
331
|
cdef xmlNode* xmlNewDocText(xmlDoc* doc, const_xmlChar* content)
|
331
332
|
cdef xmlNode* xmlNewDocComment(xmlDoc* doc, const_xmlChar* content)
|
@@ -437,7 +438,7 @@ cdef extern from "libxml/xmlIO.h":
|
|
437
438
|
cdef xmlOutputBuffer* xmlOutputBufferCreateIO(
|
438
439
|
xmlOutputWriteCallback iowrite,
|
439
440
|
xmlOutputCloseCallback ioclose,
|
440
|
-
void * ioctx,
|
441
|
+
void * ioctx,
|
441
442
|
xmlCharEncodingHandler* encoder) nogil
|
442
443
|
cdef xmlOutputBuffer* xmlOutputBufferCreateFile(
|
443
444
|
stdio.FILE* file, xmlCharEncodingHandler* encoder) nogil
|
@@ -471,14 +472,11 @@ cdef extern from "libxml/globals.h" nogil:
|
|
471
472
|
cdef int xmlThrDefKeepBlanksDefaultValue(int onoff)
|
472
473
|
cdef int xmlThrDefLineNumbersDefaultValue(int onoff)
|
473
474
|
cdef int xmlThrDefIndentTreeOutput(int onoff)
|
474
|
-
|
475
|
+
|
475
476
|
cdef extern from "libxml/xmlmemory.h" nogil:
|
476
477
|
cdef void* xmlMalloc(size_t size)
|
477
478
|
cdef int xmlMemBlocks()
|
478
479
|
cdef int xmlMemUsed()
|
479
|
-
cdef void xmlMemDisplay(stdio.FILE* file)
|
480
|
-
cdef void xmlMemDisplayLast(stdio.FILE* file, long num_bytes)
|
481
|
-
cdef void xmlMemShow(stdio.FILE* file, int count)
|
482
480
|
|
483
481
|
cdef extern from "etree_defs.h" nogil:
|
484
482
|
cdef bint _isElement(xmlNode* node)
|
lxml/includes/xmlparser.pxd
CHANGED
@@ -32,11 +32,11 @@ cdef extern from "libxml/parser.h" nogil:
|
|
32
32
|
|
33
33
|
ctypedef void (*commentSAXFunc)(void* ctx, const_xmlChar* value) noexcept
|
34
34
|
|
35
|
-
ctypedef void (*processingInstructionSAXFunc)(void* ctx,
|
35
|
+
ctypedef void (*processingInstructionSAXFunc)(void* ctx,
|
36
36
|
const_xmlChar* target,
|
37
37
|
const_xmlChar* data) noexcept
|
38
38
|
|
39
|
-
ctypedef void (*internalSubsetSAXFunc)(void* ctx,
|
39
|
+
ctypedef void (*internalSubsetSAXFunc)(void* ctx,
|
40
40
|
const_xmlChar* name,
|
41
41
|
const_xmlChar* externalID,
|
42
42
|
const_xmlChar* systemID) noexcept
|
@@ -99,11 +99,48 @@ cdef extern from "libxml/xmlIO.h" nogil:
|
|
99
99
|
|
100
100
|
cdef extern from "libxml/parser.h" nogil:
|
101
101
|
|
102
|
+
ctypedef enum xmlFeature:
|
103
|
+
XML_WITH_THREAD = 1
|
104
|
+
XML_WITH_TREE = 2
|
105
|
+
XML_WITH_OUTPUT = 3
|
106
|
+
XML_WITH_PUSH = 4
|
107
|
+
XML_WITH_READER = 5
|
108
|
+
XML_WITH_PATTERN = 6
|
109
|
+
XML_WITH_WRITER = 7
|
110
|
+
XML_WITH_SAX1 = 8
|
111
|
+
XML_WITH_FTP = 9
|
112
|
+
XML_WITH_HTTP = 10
|
113
|
+
XML_WITH_VALID = 11
|
114
|
+
XML_WITH_HTML = 12
|
115
|
+
XML_WITH_LEGACY = 13
|
116
|
+
XML_WITH_C14N = 14
|
117
|
+
XML_WITH_CATALOG = 15
|
118
|
+
XML_WITH_XPATH = 16
|
119
|
+
XML_WITH_XPTR = 17
|
120
|
+
XML_WITH_XINCLUDE = 18
|
121
|
+
XML_WITH_ICONV = 19
|
122
|
+
XML_WITH_ISO8859X = 20
|
123
|
+
XML_WITH_UNICODE = 21
|
124
|
+
XML_WITH_REGEXP = 22
|
125
|
+
XML_WITH_AUTOMATA = 23
|
126
|
+
XML_WITH_EXPR = 24
|
127
|
+
XML_WITH_SCHEMAS = 25
|
128
|
+
XML_WITH_SCHEMATRON = 26
|
129
|
+
XML_WITH_MODULES = 27
|
130
|
+
XML_WITH_DEBUG = 28
|
131
|
+
XML_WITH_DEBUG_MEM = 29
|
132
|
+
XML_WITH_DEBUG_RUN = 30
|
133
|
+
XML_WITH_ZLIB = 31
|
134
|
+
XML_WITH_ICU = 32
|
135
|
+
XML_WITH_LZMA = 33
|
136
|
+
|
137
|
+
cdef bint xmlHasFeature(xmlFeature feature)
|
138
|
+
|
102
139
|
cdef xmlDict* xmlDictCreate()
|
103
140
|
cdef xmlDict* xmlDictCreateSub(xmlDict* subdict)
|
104
141
|
cdef void xmlDictFree(xmlDict* sub)
|
105
142
|
cdef int xmlDictReference(xmlDict* dict)
|
106
|
-
|
143
|
+
|
107
144
|
cdef int XML_COMPLETE_ATTRS # SAX option for adding DTD default attributes
|
108
145
|
cdef int XML_SKIP_IDS # SAX option for not building an XML ID dict
|
109
146
|
|
@@ -207,9 +244,9 @@ cdef extern from "libxml/parser.h" nogil:
|
|
207
244
|
cdef xmlDoc* xmlCtxtReadFile(xmlParserCtxt* ctxt,
|
208
245
|
char* filename, char* encoding,
|
209
246
|
int options)
|
210
|
-
cdef xmlDoc* xmlCtxtReadIO(xmlParserCtxt* ctxt,
|
211
|
-
xmlInputReadCallback ioread,
|
212
|
-
xmlInputCloseCallback ioclose,
|
247
|
+
cdef xmlDoc* xmlCtxtReadIO(xmlParserCtxt* ctxt,
|
248
|
+
xmlInputReadCallback ioread,
|
249
|
+
xmlInputCloseCallback ioclose,
|
213
250
|
void* ioctx,
|
214
251
|
char* URL, char* encoding,
|
215
252
|
int options)
|
@@ -257,9 +294,10 @@ cdef extern from "libxml/parser.h" nogil:
|
|
257
294
|
|
258
295
|
cdef extern from "libxml/parserInternals.h" nogil:
|
259
296
|
cdef xmlParserInput* xmlNewInputStream(xmlParserCtxt* ctxt)
|
260
|
-
cdef xmlParserInput* xmlNewStringInputStream(xmlParserCtxt* ctxt,
|
297
|
+
cdef xmlParserInput* xmlNewStringInputStream(xmlParserCtxt* ctxt,
|
261
298
|
char* buffer)
|
262
|
-
cdef xmlParserInput* xmlNewInputFromFile(xmlParserCtxt* ctxt,
|
299
|
+
cdef xmlParserInput* xmlNewInputFromFile(xmlParserCtxt* ctxt,
|
263
300
|
char* filename)
|
264
301
|
cdef void xmlFreeInputStream(xmlParserInput* input)
|
265
302
|
cdef int xmlSwitchEncoding(xmlParserCtxt* ctxt, int enc)
|
303
|
+
cdef bint xmlCtxtIsStopped(xmlParserCtxt* ctxt)
|
lxml/lxml.etree.h
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
/* Generated by Cython 3.
|
1
|
+
/* Generated by Cython 3.1.2 */
|
2
2
|
|
3
3
|
#ifndef __PYX_HAVE__lxml__etree
|
4
4
|
#define __PYX_HAVE__lxml__etree
|
@@ -13,22 +13,22 @@ struct LxmlElementBase;
|
|
13
13
|
struct LxmlElementClassLookup;
|
14
14
|
struct LxmlFallbackElementClassLookup;
|
15
15
|
|
16
|
-
/* "lxml/etree.pyx":
|
16
|
+
/* "lxml/etree.pyx":451
|
17
17
|
*
|
18
18
|
* # type of a function that steps from node to node
|
19
19
|
* ctypedef public xmlNode* (*_node_to_node_function)(xmlNode*) # <<<<<<<<<<<<<<
|
20
20
|
*
|
21
21
|
*
|
22
|
-
|
22
|
+
*/
|
23
23
|
typedef xmlNode *(*_node_to_node_function)(xmlNode *);
|
24
24
|
|
25
|
-
/* "lxml/etree.pyx":
|
26
|
-
*
|
27
|
-
* @cython.freelist(8)
|
28
|
-
* cdef public class _Document [ type LxmlDocumentType, object LxmlDocument ]: # <<<<<<<<<<<<<<
|
29
|
-
* """Internal base class to reference a libxml document.
|
25
|
+
/* "lxml/etree.pyx":465
|
26
|
+
* # Public Python API
|
30
27
|
*
|
31
|
-
|
28
|
+
* @cython.final # <<<<<<<<<<<<<<
|
29
|
+
* @cython.freelist(8)
|
30
|
+
* cdef public class _Document [ type LxmlDocumentType, object LxmlDocument ]:
|
31
|
+
*/
|
32
32
|
struct LxmlDocument {
|
33
33
|
PyObject_HEAD
|
34
34
|
struct __pyx_vtabstruct_4lxml_5etree__Document *__pyx_vtab;
|
@@ -38,13 +38,13 @@ struct LxmlDocument {
|
|
38
38
|
struct __pyx_obj_4lxml_5etree__BaseParser *_parser;
|
39
39
|
};
|
40
40
|
|
41
|
-
/* "lxml/etree.pyx":
|
41
|
+
/* "lxml/etree.pyx":817
|
42
42
|
*
|
43
|
-
* @cython.no_gc_clear
|
44
|
-
* cdef public class _Element [ type LxmlElementType, object LxmlElement ]: # <<<<<<<<<<<<<<
|
45
|
-
* """Element class.
|
46
43
|
*
|
47
|
-
|
44
|
+
* @cython.no_gc_clear # <<<<<<<<<<<<<<
|
45
|
+
* cdef public class _Element [ type LxmlElementType, object LxmlElement ]:
|
46
|
+
* """Element class.
|
47
|
+
*/
|
48
48
|
struct LxmlElement {
|
49
49
|
PyObject_HEAD
|
50
50
|
struct LxmlDocument *_doc;
|
@@ -52,13 +52,13 @@ struct LxmlElement {
|
|
52
52
|
PyObject *_tag;
|
53
53
|
};
|
54
54
|
|
55
|
-
/* "lxml/etree.pyx":
|
55
|
+
/* "lxml/etree.pyx":1991
|
56
56
|
*
|
57
57
|
*
|
58
58
|
* cdef public class _ElementTree [ type LxmlElementTreeType, # <<<<<<<<<<<<<<
|
59
59
|
* object LxmlElementTree ]:
|
60
60
|
* cdef _Document _doc
|
61
|
-
|
61
|
+
*/
|
62
62
|
struct LxmlElementTree {
|
63
63
|
PyObject_HEAD
|
64
64
|
struct __pyx_vtabstruct_4lxml_5etree__ElementTree *__pyx_vtab;
|
@@ -66,13 +66,13 @@ struct LxmlElementTree {
|
|
66
66
|
struct LxmlElement *_context_node;
|
67
67
|
};
|
68
68
|
|
69
|
-
/* "lxml/etree.pyx":
|
69
|
+
/* "lxml/etree.pyx":2765
|
70
70
|
*
|
71
71
|
*
|
72
72
|
* cdef public class _ElementTagMatcher [ object LxmlElementTagMatcher, # <<<<<<<<<<<<<<
|
73
73
|
* type LxmlElementTagMatcherType ]:
|
74
74
|
* """
|
75
|
-
|
75
|
+
*/
|
76
76
|
struct LxmlElementTagMatcher {
|
77
77
|
PyObject_HEAD
|
78
78
|
struct __pyx_vtabstruct_4lxml_5etree__ElementTagMatcher *__pyx_vtab;
|
@@ -82,13 +82,13 @@ struct LxmlElementTagMatcher {
|
|
82
82
|
char *_name;
|
83
83
|
};
|
84
84
|
|
85
|
-
/* "lxml/etree.pyx":
|
85
|
+
/* "lxml/etree.pyx":2796
|
86
86
|
* self._name = NULL
|
87
87
|
*
|
88
88
|
* cdef public class _ElementIterator(_ElementTagMatcher) [ # <<<<<<<<<<<<<<
|
89
89
|
* object LxmlElementIterator, type LxmlElementIteratorType ]:
|
90
90
|
* """
|
91
|
-
|
91
|
+
*/
|
92
92
|
struct LxmlElementIterator {
|
93
93
|
struct LxmlElementTagMatcher __pyx_base;
|
94
94
|
struct LxmlElement *_node;
|
@@ -101,7 +101,7 @@ struct LxmlElementIterator {
|
|
101
101
|
* cdef public class ElementBase(_Element) [ type LxmlElementBaseType, # <<<<<<<<<<<<<<
|
102
102
|
* object LxmlElementBase ]:
|
103
103
|
* """ElementBase(*children, attrib=None, nsmap=None, **_extra)
|
104
|
-
|
104
|
+
*/
|
105
105
|
struct LxmlElementBase {
|
106
106
|
struct LxmlElement __pyx_base;
|
107
107
|
};
|
@@ -112,7 +112,7 @@ struct LxmlElementBase {
|
|
112
112
|
* ctypedef public object (*_element_class_lookup_function)(object, _Document, xmlNode*) # <<<<<<<<<<<<<<
|
113
113
|
*
|
114
114
|
* # class to store element class lookup functions
|
115
|
-
|
115
|
+
*/
|
116
116
|
typedef PyObject *(*_element_class_lookup_function)(PyObject *, struct LxmlDocument *, xmlNode *);
|
117
117
|
|
118
118
|
/* "src/lxml/classlookup.pxi":213
|
@@ -121,7 +121,7 @@ typedef PyObject *(*_element_class_lookup_function)(PyObject *, struct LxmlDocum
|
|
121
121
|
* cdef public class ElementClassLookup [ type LxmlElementClassLookupType, # <<<<<<<<<<<<<<
|
122
122
|
* object LxmlElementClassLookup ]:
|
123
123
|
* """ElementClassLookup(self)
|
124
|
-
|
124
|
+
*/
|
125
125
|
struct LxmlElementClassLookup {
|
126
126
|
PyObject_HEAD
|
127
127
|
_element_class_lookup_function _lookup_function;
|
@@ -133,7 +133,7 @@ struct LxmlElementClassLookup {
|
|
133
133
|
* cdef public class FallbackElementClassLookup(ElementClassLookup) \ # <<<<<<<<<<<<<<
|
134
134
|
* [ type LxmlFallbackElementClassLookupType,
|
135
135
|
* object LxmlFallbackElementClassLookup ]:
|
136
|
-
|
136
|
+
*/
|
137
137
|
struct LxmlFallbackElementClassLookup {
|
138
138
|
struct LxmlElementClassLookup __pyx_base;
|
139
139
|
struct __pyx_vtabstruct_4lxml_5etree_FallbackElementClassLookup *__pyx_vtab;
|
@@ -224,9 +224,6 @@ __PYX_EXTERN_C xmlNs *findOrBuildNodeNsPrefix(struct LxmlDocument *, xmlNode *,
|
|
224
224
|
/* WARNING: the interface of the module init function changed in CPython 3.5. */
|
225
225
|
/* It now returns a PyModuleDef instance instead of a PyModule instance. */
|
226
226
|
|
227
|
-
#if PY_MAJOR_VERSION < 3
|
228
|
-
PyMODINIT_FUNC initetree(void);
|
229
|
-
#else
|
230
227
|
/* WARNING: Use PyImport_AppendInittab("etree", PyInit_etree) instead of calling PyInit_etree directly from Python 3.5 */
|
231
228
|
PyMODINIT_FUNC PyInit_etree(void);
|
232
229
|
|
@@ -243,6 +240,5 @@ static PyObject* __PYX_WARN_IF_PyInit_etree_INIT_CALLED(PyObject* res) {
|
|
243
240
|
}
|
244
241
|
#define PyInit_etree() __PYX_WARN_IF_PyInit_etree_INIT_CALLED(PyInit_etree())
|
245
242
|
#endif
|
246
|
-
#endif
|
247
243
|
|
248
244
|
#endif /* !__PYX_HAVE__lxml__etree */
|
lxml/lxml.etree_api.h
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
/* Generated by Cython 3.
|
1
|
+
/* Generated by Cython 3.1.2 */
|
2
2
|
|
3
3
|
#ifndef __PYX_HAVE_API__lxml__etree
|
4
4
|
#define __PYX_HAVE_API__lxml__etree
|
@@ -98,19 +98,26 @@ static void (*__pyx_api_f_4lxml_5etree_initTagMatch)(struct LxmlElementTagMatche
|
|
98
98
|
#define initTagMatch __pyx_api_f_4lxml_5etree_initTagMatch
|
99
99
|
static xmlNs *(*__pyx_api_f_4lxml_5etree_findOrBuildNodeNsPrefix)(struct LxmlDocument *, xmlNode *, const xmlChar *, const xmlChar *) = 0;
|
100
100
|
#define findOrBuildNodeNsPrefix __pyx_api_f_4lxml_5etree_findOrBuildNodeNsPrefix
|
101
|
-
|
102
|
-
|
103
|
-
|
101
|
+
static int __Pyx_ImportFunction_3_1_2(PyObject *module, const char *funcname, void (**f)(void), const char *sig);
|
102
|
+
|
103
|
+
#ifndef __PYX_HAVE_RT_ImportFunction_3_1_2
|
104
|
+
#define __PYX_HAVE_RT_ImportFunction_3_1_2
|
105
|
+
static int __Pyx_ImportFunction_3_1_2(PyObject *module, const char *funcname, void (**f)(void), const char *sig) {
|
104
106
|
PyObject *d = 0;
|
105
107
|
PyObject *cobj = 0;
|
106
108
|
union {
|
107
109
|
void (*fp)(void);
|
108
110
|
void *p;
|
109
111
|
} tmp;
|
110
|
-
d = PyObject_GetAttrString(module,
|
112
|
+
d = PyObject_GetAttrString(module, "__pyx_capi__");
|
111
113
|
if (!d)
|
112
114
|
goto bad;
|
115
|
+
#if (defined(Py_LIMITED_API) && Py_LIMITED_API >= 0x030d0000) || (!defined(Py_LIMITED_API) && PY_VERSION_HEX >= 0x030d0000)
|
116
|
+
PyDict_GetItemStringRef(d, funcname, &cobj);
|
117
|
+
#else
|
113
118
|
cobj = PyDict_GetItemString(d, funcname);
|
119
|
+
Py_XINCREF(cobj);
|
120
|
+
#endif
|
114
121
|
if (!cobj) {
|
115
122
|
PyErr_Format(PyExc_ImportError,
|
116
123
|
"%.200s does not export expected C function %.200s",
|
@@ -128,9 +135,11 @@ static int __Pyx_ImportFunction_3_0_12(PyObject *module, const char *funcname, v
|
|
128
135
|
if (!(*f))
|
129
136
|
goto bad;
|
130
137
|
Py_DECREF(d);
|
138
|
+
Py_DECREF(cobj);
|
131
139
|
return 0;
|
132
140
|
bad:
|
133
141
|
Py_XDECREF(d);
|
142
|
+
Py_XDECREF(cobj);
|
134
143
|
return -1;
|
135
144
|
}
|
136
145
|
#endif
|
@@ -140,51 +149,51 @@ static int import_lxml__etree(void) {
|
|
140
149
|
PyObject *module = 0;
|
141
150
|
module = PyImport_ImportModule("lxml.etree");
|
142
151
|
if (!module) goto bad;
|
143
|
-
if (
|
144
|
-
if (
|
145
|
-
if (
|
146
|
-
if (
|
147
|
-
if (
|
148
|
-
if (
|
149
|
-
if (
|
150
|
-
if (
|
151
|
-
if (
|
152
|
-
if (
|
153
|
-
if (
|
154
|
-
if (
|
155
|
-
if (
|
156
|
-
if (
|
157
|
-
if (
|
158
|
-
if (
|
159
|
-
if (
|
160
|
-
if (
|
161
|
-
if (
|
162
|
-
if (
|
163
|
-
if (
|
164
|
-
if (
|
165
|
-
if (
|
166
|
-
if (
|
167
|
-
if (
|
168
|
-
if (
|
169
|
-
if (
|
170
|
-
if (
|
171
|
-
if (
|
172
|
-
if (
|
173
|
-
if (
|
174
|
-
if (
|
175
|
-
if (
|
176
|
-
if (
|
177
|
-
if (
|
178
|
-
if (
|
179
|
-
if (
|
180
|
-
if (
|
181
|
-
if (
|
182
|
-
if (
|
183
|
-
if (
|
184
|
-
if (
|
185
|
-
if (
|
186
|
-
if (
|
187
|
-
if (
|
152
|
+
if (__Pyx_ImportFunction_3_1_2(module, "deepcopyNodeToDocument", (void (**)(void))&__pyx_api_f_4lxml_5etree_deepcopyNodeToDocument, "struct LxmlElement *(struct LxmlDocument *, xmlNode *)") < 0) goto bad;
|
153
|
+
if (__Pyx_ImportFunction_3_1_2(module, "elementTreeFactory", (void (**)(void))&__pyx_api_f_4lxml_5etree_elementTreeFactory, "struct LxmlElementTree *(struct LxmlElement *)") < 0) goto bad;
|
154
|
+
if (__Pyx_ImportFunction_3_1_2(module, "newElementTree", (void (**)(void))&__pyx_api_f_4lxml_5etree_newElementTree, "struct LxmlElementTree *(struct LxmlElement *, PyObject *)") < 0) goto bad;
|
155
|
+
if (__Pyx_ImportFunction_3_1_2(module, "adoptExternalDocument", (void (**)(void))&__pyx_api_f_4lxml_5etree_adoptExternalDocument, "struct LxmlElementTree *(xmlDoc *, PyObject *, int)") < 0) goto bad;
|
156
|
+
if (__Pyx_ImportFunction_3_1_2(module, "elementFactory", (void (**)(void))&__pyx_api_f_4lxml_5etree_elementFactory, "struct LxmlElement *(struct LxmlDocument *, xmlNode *)") < 0) goto bad;
|
157
|
+
if (__Pyx_ImportFunction_3_1_2(module, "makeElement", (void (**)(void))&__pyx_api_f_4lxml_5etree_makeElement, "struct LxmlElement *(PyObject *, struct LxmlDocument *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *)") < 0) goto bad;
|
158
|
+
if (__Pyx_ImportFunction_3_1_2(module, "makeSubElement", (void (**)(void))&__pyx_api_f_4lxml_5etree_makeSubElement, "struct LxmlElement *(struct LxmlElement *, PyObject *, PyObject *, PyObject *, PyObject *, PyObject *)") < 0) goto bad;
|
159
|
+
if (__Pyx_ImportFunction_3_1_2(module, "setElementClassLookupFunction", (void (**)(void))&__pyx_api_f_4lxml_5etree_setElementClassLookupFunction, "void (_element_class_lookup_function, PyObject *)") < 0) goto bad;
|
160
|
+
if (__Pyx_ImportFunction_3_1_2(module, "lookupDefaultElementClass", (void (**)(void))&__pyx_api_f_4lxml_5etree_lookupDefaultElementClass, "PyObject *(PyObject *, PyObject *, xmlNode *)") < 0) goto bad;
|
161
|
+
if (__Pyx_ImportFunction_3_1_2(module, "lookupNamespaceElementClass", (void (**)(void))&__pyx_api_f_4lxml_5etree_lookupNamespaceElementClass, "PyObject *(PyObject *, PyObject *, xmlNode *)") < 0) goto bad;
|
162
|
+
if (__Pyx_ImportFunction_3_1_2(module, "callLookupFallback", (void (**)(void))&__pyx_api_f_4lxml_5etree_callLookupFallback, "PyObject *(struct LxmlFallbackElementClassLookup *, struct LxmlDocument *, xmlNode *)") < 0) goto bad;
|
163
|
+
if (__Pyx_ImportFunction_3_1_2(module, "tagMatches", (void (**)(void))&__pyx_api_f_4lxml_5etree_tagMatches, "int (xmlNode *, const xmlChar *, const xmlChar *)") < 0) goto bad;
|
164
|
+
if (__Pyx_ImportFunction_3_1_2(module, "documentOrRaise", (void (**)(void))&__pyx_api_f_4lxml_5etree_documentOrRaise, "struct LxmlDocument *(PyObject *)") < 0) goto bad;
|
165
|
+
if (__Pyx_ImportFunction_3_1_2(module, "rootNodeOrRaise", (void (**)(void))&__pyx_api_f_4lxml_5etree_rootNodeOrRaise, "struct LxmlElement *(PyObject *)") < 0) goto bad;
|
166
|
+
if (__Pyx_ImportFunction_3_1_2(module, "hasText", (void (**)(void))&__pyx_api_f_4lxml_5etree_hasText, "int (xmlNode *)") < 0) goto bad;
|
167
|
+
if (__Pyx_ImportFunction_3_1_2(module, "hasTail", (void (**)(void))&__pyx_api_f_4lxml_5etree_hasTail, "int (xmlNode *)") < 0) goto bad;
|
168
|
+
if (__Pyx_ImportFunction_3_1_2(module, "textOf", (void (**)(void))&__pyx_api_f_4lxml_5etree_textOf, "PyObject *(xmlNode *)") < 0) goto bad;
|
169
|
+
if (__Pyx_ImportFunction_3_1_2(module, "tailOf", (void (**)(void))&__pyx_api_f_4lxml_5etree_tailOf, "PyObject *(xmlNode *)") < 0) goto bad;
|
170
|
+
if (__Pyx_ImportFunction_3_1_2(module, "setNodeText", (void (**)(void))&__pyx_api_f_4lxml_5etree_setNodeText, "int (xmlNode *, PyObject *)") < 0) goto bad;
|
171
|
+
if (__Pyx_ImportFunction_3_1_2(module, "setTailText", (void (**)(void))&__pyx_api_f_4lxml_5etree_setTailText, "int (xmlNode *, PyObject *)") < 0) goto bad;
|
172
|
+
if (__Pyx_ImportFunction_3_1_2(module, "attributeValue", (void (**)(void))&__pyx_api_f_4lxml_5etree_attributeValue, "PyObject *(xmlNode *, xmlAttr *)") < 0) goto bad;
|
173
|
+
if (__Pyx_ImportFunction_3_1_2(module, "attributeValueFromNsName", (void (**)(void))&__pyx_api_f_4lxml_5etree_attributeValueFromNsName, "PyObject *(xmlNode *, const xmlChar *, const xmlChar *)") < 0) goto bad;
|
174
|
+
if (__Pyx_ImportFunction_3_1_2(module, "getAttributeValue", (void (**)(void))&__pyx_api_f_4lxml_5etree_getAttributeValue, "PyObject *(struct LxmlElement *, PyObject *, PyObject *)") < 0) goto bad;
|
175
|
+
if (__Pyx_ImportFunction_3_1_2(module, "iterattributes", (void (**)(void))&__pyx_api_f_4lxml_5etree_iterattributes, "PyObject *(struct LxmlElement *, int)") < 0) goto bad;
|
176
|
+
if (__Pyx_ImportFunction_3_1_2(module, "collectAttributes", (void (**)(void))&__pyx_api_f_4lxml_5etree_collectAttributes, "PyObject *(xmlNode *, int)") < 0) goto bad;
|
177
|
+
if (__Pyx_ImportFunction_3_1_2(module, "setAttributeValue", (void (**)(void))&__pyx_api_f_4lxml_5etree_setAttributeValue, "int (struct LxmlElement *, PyObject *, PyObject *)") < 0) goto bad;
|
178
|
+
if (__Pyx_ImportFunction_3_1_2(module, "delAttribute", (void (**)(void))&__pyx_api_f_4lxml_5etree_delAttribute, "int (struct LxmlElement *, PyObject *)") < 0) goto bad;
|
179
|
+
if (__Pyx_ImportFunction_3_1_2(module, "delAttributeFromNsName", (void (**)(void))&__pyx_api_f_4lxml_5etree_delAttributeFromNsName, "int (xmlNode *, const xmlChar *, const xmlChar *)") < 0) goto bad;
|
180
|
+
if (__Pyx_ImportFunction_3_1_2(module, "hasChild", (void (**)(void))&__pyx_api_f_4lxml_5etree_hasChild, "int (xmlNode *)") < 0) goto bad;
|
181
|
+
if (__Pyx_ImportFunction_3_1_2(module, "findChild", (void (**)(void))&__pyx_api_f_4lxml_5etree_findChild, "xmlNode *(xmlNode *, Py_ssize_t)") < 0) goto bad;
|
182
|
+
if (__Pyx_ImportFunction_3_1_2(module, "findChildForwards", (void (**)(void))&__pyx_api_f_4lxml_5etree_findChildForwards, "xmlNode *(xmlNode *, Py_ssize_t)") < 0) goto bad;
|
183
|
+
if (__Pyx_ImportFunction_3_1_2(module, "findChildBackwards", (void (**)(void))&__pyx_api_f_4lxml_5etree_findChildBackwards, "xmlNode *(xmlNode *, Py_ssize_t)") < 0) goto bad;
|
184
|
+
if (__Pyx_ImportFunction_3_1_2(module, "nextElement", (void (**)(void))&__pyx_api_f_4lxml_5etree_nextElement, "xmlNode *(xmlNode *)") < 0) goto bad;
|
185
|
+
if (__Pyx_ImportFunction_3_1_2(module, "previousElement", (void (**)(void))&__pyx_api_f_4lxml_5etree_previousElement, "xmlNode *(xmlNode *)") < 0) goto bad;
|
186
|
+
if (__Pyx_ImportFunction_3_1_2(module, "appendChild", (void (**)(void))&__pyx_api_f_4lxml_5etree_appendChild, "void (struct LxmlElement *, struct LxmlElement *)") < 0) goto bad;
|
187
|
+
if (__Pyx_ImportFunction_3_1_2(module, "appendChildToElement", (void (**)(void))&__pyx_api_f_4lxml_5etree_appendChildToElement, "int (struct LxmlElement *, struct LxmlElement *)") < 0) goto bad;
|
188
|
+
if (__Pyx_ImportFunction_3_1_2(module, "pyunicode", (void (**)(void))&__pyx_api_f_4lxml_5etree_pyunicode, "PyObject *(const xmlChar *)") < 0) goto bad;
|
189
|
+
if (__Pyx_ImportFunction_3_1_2(module, "utf8", (void (**)(void))&__pyx_api_f_4lxml_5etree_utf8, "PyObject *(PyObject *)") < 0) goto bad;
|
190
|
+
if (__Pyx_ImportFunction_3_1_2(module, "getNsTag", (void (**)(void))&__pyx_api_f_4lxml_5etree_getNsTag, "PyObject *(PyObject *)") < 0) goto bad;
|
191
|
+
if (__Pyx_ImportFunction_3_1_2(module, "getNsTagWithEmptyNs", (void (**)(void))&__pyx_api_f_4lxml_5etree_getNsTagWithEmptyNs, "PyObject *(PyObject *)") < 0) goto bad;
|
192
|
+
if (__Pyx_ImportFunction_3_1_2(module, "namespacedName", (void (**)(void))&__pyx_api_f_4lxml_5etree_namespacedName, "PyObject *(xmlNode *)") < 0) goto bad;
|
193
|
+
if (__Pyx_ImportFunction_3_1_2(module, "namespacedNameFromNsName", (void (**)(void))&__pyx_api_f_4lxml_5etree_namespacedNameFromNsName, "PyObject *(const xmlChar *, const xmlChar *)") < 0) goto bad;
|
194
|
+
if (__Pyx_ImportFunction_3_1_2(module, "iteratorStoreNext", (void (**)(void))&__pyx_api_f_4lxml_5etree_iteratorStoreNext, "void (struct LxmlElementIterator *, struct LxmlElement *)") < 0) goto bad;
|
195
|
+
if (__Pyx_ImportFunction_3_1_2(module, "initTagMatch", (void (**)(void))&__pyx_api_f_4lxml_5etree_initTagMatch, "void (struct LxmlElementTagMatcher *, PyObject *)") < 0) goto bad;
|
196
|
+
if (__Pyx_ImportFunction_3_1_2(module, "findOrBuildNodeNsPrefix", (void (**)(void))&__pyx_api_f_4lxml_5etree_findOrBuildNodeNsPrefix, "xmlNs *(struct LxmlDocument *, xmlNode *, const xmlChar *, const xmlChar *)") < 0) goto bad;
|
188
197
|
Py_DECREF(module); module = 0;
|
189
198
|
return 0;
|
190
199
|
bad:
|
lxml/objectify.cp312-win32.pyd
CHANGED
Binary file
|
lxml/objectify.pyx
CHANGED
@@ -18,6 +18,7 @@ from lxml.includes cimport tree
|
|
18
18
|
cimport lxml.includes.etreepublic as cetree
|
19
19
|
cimport libc.string as cstring_h # not to be confused with stdlib 'string'
|
20
20
|
from libc.string cimport const_char
|
21
|
+
from libc cimport limits
|
21
22
|
|
22
23
|
__all__ = ['BoolElement', 'DataElement', 'E', 'Element', 'ElementMaker',
|
23
24
|
'FloatElement', 'IntElement', 'NoneElement',
|
@@ -420,8 +421,11 @@ cdef object _lookupChild(_Element parent, tag):
|
|
420
421
|
cdef tree.xmlNode* c_node
|
421
422
|
c_node = parent._c_node
|
422
423
|
ns, tag = cetree.getNsTagWithEmptyNs(tag)
|
424
|
+
c_tag_len = len(<bytes> tag)
|
425
|
+
if c_tag_len > limits.INT_MAX:
|
426
|
+
return None
|
423
427
|
c_tag = tree.xmlDictExists(
|
424
|
-
c_node.doc.dict, _xcstr(tag),
|
428
|
+
c_node.doc.dict, _xcstr(tag), <int> c_tag_len)
|
425
429
|
if c_tag is NULL:
|
426
430
|
return None # not in the hash map => not in the tree
|
427
431
|
if ns is None:
|
@@ -1283,7 +1287,7 @@ cdef object _guessElementClass(tree.xmlNode* c_node):
|
|
1283
1287
|
return None
|
1284
1288
|
if value == '':
|
1285
1289
|
return StringElement
|
1286
|
-
|
1290
|
+
|
1287
1291
|
for type_check, pytype in _TYPE_CHECKS:
|
1288
1292
|
try:
|
1289
1293
|
type_check(value)
|
@@ -1689,8 +1693,8 @@ def annotate(element_or_tree, *, ignore_old=True, ignore_xsi=False,
|
|
1689
1693
|
|
1690
1694
|
If the 'ignore_xsi' keyword argument is False (the default), existing
|
1691
1695
|
'xsi:type' attributes will be used for the type annotation, if they fit the
|
1692
|
-
element text values.
|
1693
|
-
|
1696
|
+
element text values.
|
1697
|
+
|
1694
1698
|
Note that the mapping from Python types to XSI types is usually ambiguous.
|
1695
1699
|
Currently, only the first XSI type name in the corresponding PyType
|
1696
1700
|
definition will be used for annotation. Thus, you should consider naming
|
@@ -1705,7 +1709,7 @@ def annotate(element_or_tree, *, ignore_old=True, ignore_xsi=False,
|
|
1705
1709
|
elements. Pass 'string', for example, to make string values the default.
|
1706
1710
|
|
1707
1711
|
The keyword arguments 'annotate_xsi' (default: 0) and 'annotate_pytype'
|
1708
|
-
(default: 1) control which kind(s) of annotation to use.
|
1712
|
+
(default: 1) control which kind(s) of annotation to use.
|
1709
1713
|
"""
|
1710
1714
|
cdef _Element element
|
1711
1715
|
element = cetree.rootNodeOrRaise(element_or_tree)
|
@@ -1878,7 +1882,7 @@ def deannotate(element_or_tree, *, bint pytype=True, bint xsi=True,
|
|
1878
1882
|
and/or 'xsi:type' attributes and/or 'xsi:nil' attributes.
|
1879
1883
|
|
1880
1884
|
If the 'pytype' keyword argument is True (the default), 'py:pytype'
|
1881
|
-
attributes will be removed. If the 'xsi' keyword argument is True (the
|
1885
|
+
attributes will be removed. If the 'xsi' keyword argument is True (the
|
1882
1886
|
default), 'xsi:type' attributes will be removed.
|
1883
1887
|
If the 'xsi_nil' keyword argument is True (default: False), 'xsi:nil'
|
1884
1888
|
attributes will be removed.
|
@@ -2124,7 +2128,7 @@ def DataElement(_value, attrib=None, nsmap=None, *, _pytype=None, _xsi=None,
|
|
2124
2128
|
stringify = unicode if py_type is None else py_type.stringify
|
2125
2129
|
strval = stringify(_value)
|
2126
2130
|
|
2127
|
-
if _pytype is not None:
|
2131
|
+
if _pytype is not None:
|
2128
2132
|
if _pytype == "NoneType" or _pytype == "none":
|
2129
2133
|
strval = None
|
2130
2134
|
_attributes[XML_SCHEMA_INSTANCE_NIL_ATTR] = "true"
|