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
diff --git a/python/libxml.py b/python/libxml.py
index 4c9fe92..988a166 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):