Bug 199002 - Some objects report negative addresses
Summary: Some objects report negative addresses
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Fedora
Classification: Fedora
Component: libxml2
Version: rawhide
Hardware: i386
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Daniel Veillard
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2006-07-15 15:28 UTC by Ralf Ertzinger
Modified: 2007-11-30 22:11 UTC (History)
1 user (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2006-12-14 15:49:47 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
patch to make sure id() extraction is always positive (2.24 KB, patch)
2006-12-14 15:51 UTC, Daniel Veillard
no flags Details | Diff

Description Ralf Ertzinger 2006-07-15 15:28:01 UTC
Description of problem:
I am not sure where to place this, so feel free to reassign.

Consider the following python session:
<<---snip--->>
>>> import libxml2
>>> import urllib2

>>> f = urllib2.urlopen("http://ryoko.camperquake.de")
>>> s = f.read()
>>> f.close()

>>> d = libxml2.parseDoc(s)
>>> d
<xmlDoc (None) object at 0x-48304c34>
<<---snip--->>

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):
python-2.4.3-11.FC6
libxml2-python-2.6.26-2

How reproducible:
Sometimes, not all objects show this behaviour

Steps to Reproduce:
1. As seen above
2.
3.
  
Actual results:
Negative memory addresses show up sometimes

Expected results:
Non-negative addresses would be nice :)

Additional info:

Comment 1 Mihai Ibanescu 2006-07-17 03:26:11 UTC
This has been discussed extensively on the python-dev mailing list.

http://mail.python.org/pipermail/python-dev/2005-February/051562.html
http://codespeak.net/pipermail/pypy-dev/2004q4/001629.html

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.

Comment 3 Daniel Veillard 2006-12-14 15:49:47 UTC
Bahh ... %X generating a negative string, you have to be a python 
maintainer to consider this sane, sigh ...

Daniel

Comment 4 Daniel Veillard 2006-12-14 15:51:05 UTC
Created attachment 143643 [details]
patch to make sure id() extraction is always positive


Note You need to log in before you can comment on or make changes to this bug.