diff --git a/ChangeLog b/ChangeLog index e40a6f64..cc12ea00 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Thu Dec 14 16:52:34 CET 2006 Daniel Veillard + + * python/generator.py python/libxml.py: apparently id() sometimes + generate negative values and %X outputs -XXXX :-( + Mon Dec 4 10:30:25 CET 2006 Daniel Veillard * parser.c include/libxml/tree.h: patch from Michael Day on standalone diff --git a/python/generator.py b/python/generator.py index f116f8ab..a38a23c5 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.py b/python/libxml.py index 4c9fe92f..988a1662 100644 --- a/python/libxml.py +++ b/python/libxml.py @@ -1,9 +1,19 @@ 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. #