diff options
author | Mike Hommey <glandium@debian.org> | 2007-04-17 20:40:00 +0200 |
---|---|---|
committer | Mike Hommey <glandium@debian.org> | 2007-04-17 20:40:00 +0200 |
commit | 789259a1b6850d30acffbb62b11456b9ed7a8f59 (patch) | |
tree | 842f2f9042a4264898ec29078aa029640078c393 /python | |
parent | 968041a8b2ec86c39b5074024ce97d136ecd9a95 (diff) | |
download | libxml2-789259a1b6850d30acffbb62b11456b9ed7a8f59.tar.gz |
Load /tmp/libxml2-2.6.28 intoupstream/2.6.28.dfsg
libxml2/branches/upstream/current.
Diffstat (limited to 'python')
-rwxr-xr-x | python/generator.py | 2 | ||||
-rw-r--r-- | python/libxml.c | 3 | ||||
-rw-r--r-- | python/libxml.py | 26 | ||||
-rw-r--r-- | python/libxml2-py.c | 24 | ||||
-rwxr-xr-x | python/setup.py | 2 |
5 files changed, 47 insertions, 10 deletions
diff --git a/python/generator.py b/python/generator.py index f116f8a..a38a23c 100755 --- a/python/generator.py +++ b/python/generator.py @@ -1055,7 +1055,7 @@ def buildWrappers(): classes_ancestor[classname] == "xmlNode": classes.write(" def __repr__(self):\n") format = "<%s (%%s) object at 0x%%x>" % (classname) - classes.write(" return \"%s\" %% (self.name, long(id (self)))\n\n" % ( + classes.write(" return \"%s\" %% (self.name, long(pos_id (self)))\n\n" % ( format)) else: txt.write("Class %s()\n" % (classname)) diff --git a/python/libxml.c b/python/libxml.c index 6e9a78e..747e44c 100644 --- a/python/libxml.c +++ b/python/libxml.c @@ -773,6 +773,8 @@ pythonStartElement(void *user_data, const xmlChar * name, attrvalue = Py_None; } PyDict_SetItem(dict, attrname, attrvalue); + Py_DECREF(attrname); + Py_DECREF(attrvalue); } } @@ -1170,6 +1172,7 @@ pythonAttributeDecl(void *user_data, for (node = tree; node != NULL; node = node->next) { newName = PyString_FromString((char *) node->name); PyList_SetItem(nameList, count, newName); + Py_DECREF(newName); count++; } result = PyObject_CallMethod(handler, (char *) "attributeDecl", diff --git a/python/libxml.py b/python/libxml.py index 4c9fe92..18cfad2 100644 --- a/python/libxml.py +++ b/python/libxml.py @@ -1,10 +1,20 @@ import libxml2mod import types +import sys # The root of all libxml2 errors. class libxmlError(Exception): pass # +# id() is sometimes negative ... +# +def pos_id(o): + i = id(o) + if (i < 0): + return (sys.maxint - i) + return i + +# # Errors raised by the wrappers when some tree handling failed. # class treeError(libxmlError): @@ -235,19 +245,19 @@ class xmlCore: def __eq__(self, other): if other == None: - return False + return False ret = libxml2mod.compareNodesEqual(self._o, other._o) - if ret == None: - return False - return ret == True + if ret == None: + return False + return ret == True def __ne__(self, other): if other == None: - return True + return True ret = libxml2mod.compareNodesEqual(self._o, other._o) - return not ret + return not ret def __hash__(self): - ret = libxml2mod.nodeHash(self._o) - return ret + ret = libxml2mod.nodeHash(self._o) + return ret def __str__(self): return self.serialize() diff --git a/python/libxml2-py.c b/python/libxml2-py.c index 853a894..c979a3a 100644 --- a/python/libxml2-py.c +++ b/python/libxml2-py.c @@ -9249,6 +9249,30 @@ libxml_xmlFreeDtd(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { return(Py_None); } +#if defined(LIBXML_READER_ENABLED) +PyObject * +libxml_xmlTextReaderSetup(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { + PyObject *py_retval; + int c_retval; + xmlTextReaderPtr reader; + PyObject *pyobj_reader; + xmlParserInputBufferPtr input; + PyObject *pyobj_input; + char * URL; + char * encoding; + int options; + + if (!PyArg_ParseTuple(args, (char *)"OOzzi:xmlTextReaderSetup", &pyobj_reader, &pyobj_input, &URL, &encoding, &options)) + return(NULL); + reader = (xmlTextReaderPtr) PyxmlTextReader_Get(pyobj_reader); + input = (xmlParserInputBufferPtr) PyinputBuffer_Get(pyobj_input); + + c_retval = xmlTextReaderSetup(reader, input, URL, encoding, options); + py_retval = libxml_intWrap((int) c_retval); + return(py_retval); +} + +#endif /* defined(LIBXML_READER_ENABLED) */ PyObject * libxml_xmlSetListDoc(PyObject *self ATTRIBUTE_UNUSED, PyObject *args) { xmlNodePtr list; diff --git a/python/setup.py b/python/setup.py index 9e3300b..5eab8dc 100755 --- a/python/setup.py +++ b/python/setup.py @@ -226,7 +226,7 @@ else: setup (name = "libxml2-python", # On *nix, the version number is created from setup.py.in # On windows, it is set by configure.js - version = "2.6.27", + version = "2.6.28", description = descr, author = "Daniel Veillard", author_email = "veillard@redhat.com", |