From c68d78d25a17e65d172ccc1ac24d609c7c1d5cde Mon Sep 17 00:00:00 2001 From: "William M. Brack" Date: Fri, 16 Jul 2004 10:39:30 +0000 Subject: added a check on the argument for some classes (e.g. xmlDoc and xmlNode) * python/generator.py: added a check on the argument for some classes (e.g. xmlDoc and xmlNode) to prevent a segfault (as reported on the list). Further enhancement should be done to auto-create the appropriate object. * python/libxml.c: minor fix for a warning message; added a routine, currently not used, to report the description of a PyCObject. * python/libxml2class.txt: regenerated --- python/libxml.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'python/libxml.c') diff --git a/python/libxml.c b/python/libxml.c index 3db0f5ff..9dda18c7 100644 --- a/python/libxml.c +++ b/python/libxml.c @@ -95,7 +95,8 @@ static void libxml_xmlErrorInitialize(void); /* forward declare */ PyObject * -libxml_xmlMemoryUsed(ATTRIBUTE_UNUSED PyObject * self, PyObject * args) +libxml_xmlMemoryUsed(PyObject * self ATTRIBUTE_UNUSED, + PyObject * args ATTRIBUTE_UNUSED) { long ret; PyObject *py_retval; @@ -107,7 +108,7 @@ libxml_xmlMemoryUsed(ATTRIBUTE_UNUSED PyObject * self, PyObject * args) } PyObject * -libxml_xmlDebugMemory(ATTRIBUTE_UNUSED PyObject * self, PyObject * args) +libxml_xmlDebugMemory(PyObject * self ATTRIBUTE_UNUSED, PyObject * args) { int activate; PyObject *py_retval; @@ -3242,7 +3243,17 @@ libxml_C14NDocSaveTo(ATTRIBUTE_UNUSED PyObject * self, #endif #endif +static PyObject * +libxml_getObjDesc(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { + + PyObject *obj; + char *str; + if (!PyArg_ParseTuple(args, (char *)"O:getObjDesc", &obj)) + return NULL; + str = PyCObject_GetDesc(obj); + return Py_BuildValue((char *)"s", str); +} /************************************************************************ * * @@ -3289,6 +3300,7 @@ static PyMethodDef libxmlMethods[] = { {(char *)"xmlC14NDocSaveTo", libxml_C14NDocSaveTo, METH_VARARGS, NULL}, #endif #endif + {(char *) "getObjDesc", libxml_getObjDesc, METH_VARARGS, NULL}, {NULL, NULL, 0, NULL} }; -- cgit v1.2.1