Bring this back into sync with PyXML revision 1.58.

This commit is contained in:
Fred Drake 2002-07-01 14:02:31 +00:00
parent 19b74c7868
commit 7c75bf2090
1 changed files with 10 additions and 3 deletions

View File

@ -1,11 +1,17 @@
#include "Python.h" #include "Python.h"
#include <ctype.h> #include <ctype.h>
#ifdef HAVE_PYMEMCOMPAT_H
#include "pymemcompat.h"
#endif
#include "compile.h" #include "compile.h"
#include "frameobject.h" #include "frameobject.h"
#include "expat.h" #include "expat.h"
#ifndef PyDoc_STRVAR #ifndef PyDoc_STRVAR
#define PyDoc_STR(str) (str)
#define PyDoc_VAR(name) static char name[]
#define PyDoc_STRVAR(name,str) PyDoc_VAR(name) = PyDoc_STR(str) #define PyDoc_STRVAR(name,str) PyDoc_VAR(name) = PyDoc_STR(str)
#endif #endif
@ -1160,14 +1166,15 @@ newxmlparseobject(char *encoding, char *namespace_separator, PyObject *intern)
} }
XML_SetUserData(self->itself, (void *)self); XML_SetUserData(self->itself, (void *)self);
#ifdef Py_USING_UNICODE #ifdef Py_USING_UNICODE
XML_SetUnknownEncodingHandler(self->itself, (XML_UnknownEncodingHandler) PyUnknownEncodingHandler, NULL); XML_SetUnknownEncodingHandler(self->itself,
(XML_UnknownEncodingHandler) PyUnknownEncodingHandler, NULL);
#endif #endif
for (i = 0; handler_info[i].name != NULL; i++) for (i = 0; handler_info[i].name != NULL; i++)
/* do nothing */; /* do nothing */;
self->handlers = malloc(sizeof(PyObject *)*i); self->handlers = malloc(sizeof(PyObject *) * i);
if (!self->handlers){ if (!self->handlers) {
Py_DECREF(self); Py_DECREF(self);
return PyErr_NoMemory(); return PyErr_NoMemory();
} }