mirror of
https://github.com/python/cpython.git
synced 2025-10-17 12:18:23 +00:00
Issue #18227: pyexpat now uses a static XML_Memory_Handling_Suite. cElementTree uses the same approach since at least Python 2.6
This commit is contained in:
parent
0e2d3cf2cb
commit
fa535f5220
1 changed files with 6 additions and 6 deletions
|
@ -10,6 +10,9 @@
|
||||||
|
|
||||||
#define FIX_TRACE
|
#define FIX_TRACE
|
||||||
|
|
||||||
|
static XML_Memory_Handling_Suite ExpatMemoryHandler = {
|
||||||
|
PyObject_Malloc, PyObject_Realloc, PyObject_Free};
|
||||||
|
|
||||||
enum HandlerTypes {
|
enum HandlerTypes {
|
||||||
StartElement,
|
StartElement,
|
||||||
EndElement,
|
EndElement,
|
||||||
|
@ -1177,12 +1180,9 @@ newxmlparseobject(char *encoding, char *namespace_separator, PyObject *intern)
|
||||||
self->in_callback = 0;
|
self->in_callback = 0;
|
||||||
self->ns_prefixes = 0;
|
self->ns_prefixes = 0;
|
||||||
self->handlers = NULL;
|
self->handlers = NULL;
|
||||||
if (namespace_separator != NULL) {
|
/* namespace_separator is either NULL or contains one char + \0 */
|
||||||
self->itself = XML_ParserCreateNS(encoding, *namespace_separator);
|
self->itself = XML_ParserCreate_MM(encoding, &ExpatMemoryHandler,
|
||||||
}
|
namespace_separator);
|
||||||
else {
|
|
||||||
self->itself = XML_ParserCreate(encoding);
|
|
||||||
}
|
|
||||||
#if ((XML_MAJOR_VERSION >= 2) && (XML_MINOR_VERSION >= 1)) || defined(XML_HAS_SET_HASH_SALT)
|
#if ((XML_MAJOR_VERSION >= 2) && (XML_MINOR_VERSION >= 1)) || defined(XML_HAS_SET_HASH_SALT)
|
||||||
/* This feature was added upstream in libexpat 2.1.0. Our expat copy
|
/* This feature was added upstream in libexpat 2.1.0. Our expat copy
|
||||||
* has a backport of this feature where we also define XML_HAS_SET_HASH_SALT
|
* has a backport of this feature where we also define XML_HAS_SET_HASH_SALT
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue