1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-07-29 11:41:22 +03:00

apparently id() sometimes generate negative values and %X outputs -XXXX

* python/generator.py python/libxml.py: apparently id() sometimes
  generate negative values and %X outputs -XXXX :-(
Daniel
This commit is contained in:
Daniel Veillard
2006-12-14 15:49:41 +00:00
parent 602f2bd01a
commit 3b6acc93bf
3 changed files with 16 additions and 1 deletions

View File

@ -1,3 +1,8 @@
Thu Dec 14 16:52:34 CET 2006 Daniel Veillard <daniel@veillard.com>
* 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 <daniel@veillard.com> Mon Dec 4 10:30:25 CET 2006 Daniel Veillard <daniel@veillard.com>
* parser.c include/libxml/tree.h: patch from Michael Day on standalone * parser.c include/libxml/tree.h: patch from Michael Day on standalone

View File

@ -1055,7 +1055,7 @@ def buildWrappers():
classes_ancestor[classname] == "xmlNode": classes_ancestor[classname] == "xmlNode":
classes.write(" def __repr__(self):\n") classes.write(" def __repr__(self):\n")
format = "<%s (%%s) object at 0x%%x>" % (classname) 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)) format))
else: else:
txt.write("Class %s()\n" % (classname)) txt.write("Class %s()\n" % (classname))

View File

@ -1,9 +1,19 @@
import libxml2mod import libxml2mod
import types import types
import sys
# The root of all libxml2 errors. # The root of all libxml2 errors.
class libxmlError(Exception): pass 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. # Errors raised by the wrappers when some tree handling failed.
# #