Red Hat Bugzilla – Bug 199002
Some objects report negative addresses
Last modified: 2007-11-30 17:11:37 EST
Description of problem:
I am not sure where to place this, so feel free to reassign.
Consider the following python session:
>>> import libxml2
>>> import urllib2
>>> f = urllib2.urlopen("http://ryoko.camperquake.de")
>>> s = f.read()
>>> d = libxml2.parseDoc(s)
<xmlDoc (None) object at 0x-48304c34>
As can be seen, python thinks that the object is located at a negative memory
address, which is kind of strange.
Version-Release number of selected component (if applicable):
Sometimes, not all objects show this behaviour
Steps to Reproduce:
1. As seen above
Negative memory addresses show up sometimes
Non-negative addresses would be nice :)
This has been discussed extensively on the python-dev mailing list.
To summarize, one should not assume id() returns a short int, so using "%x" is
the wrong way to format the pointer's address.
Reassigning the bug to libxml2, since it doesn't look like the upstream
developers are willing to change id() in python 2.4.
Bahh ... %X generating a negative string, you have to be a python
maintainer to consider this sane, sigh ...
Created attachment 143643 [details]
patch to make sure id() extraction is always positive