From: Anthony Baxter Date: Thu, 6 Nov 2003 13:57:49 +0000 (+0000) Subject: On RH10, the PIE additions to gcc mean that id() can sometimes be a very X-Git-Tag: v2.3.3c1~72 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=68fa8d91ed1a6fb989a26b962f8d30dea8ffc67e;p=thirdparty%2FPython%2Fcpython.git On RH10, the PIE additions to gcc mean that id() can sometimes be a very large 32 bit int, which comes out as a negative int. Workaround this to prevent warnings from the test suite and the std lib. --- diff --git a/Lib/asyncore.py b/Lib/asyncore.py index 7fb84b47fa8e..fe69359def53 100644 --- a/Lib/asyncore.py +++ b/Lib/asyncore.py @@ -227,7 +227,10 @@ class dispatcher: status.append('%s:%d' % self.addr) except TypeError: status.append(repr(self.addr)) - return '<%s at %#x>' % (' '.join(status), id(self)) + # On some systems (RH10) id() can be a negative number. + # work around this. + MAX = 2L*sys.maxint+1 + return '<%s at %#x>' % (' '.join(status), id(self)&MAX) def add_channel(self, map=None): #self.log_info('adding channel %s' % self) diff --git a/Lib/tarfile.py b/Lib/tarfile.py index 26f9c7f6acff..45fe03c043bf 100644 --- a/Lib/tarfile.py +++ b/Lib/tarfile.py @@ -649,7 +649,11 @@ class TarInfo(object): self.offset_data = 0 # the file's data starts here def __repr__(self): - return "<%s %r at %#x>" % (self.__class__.__name__,self.name,id(self)) + # On some systems (RH10) id() can be a negative number. + # work around this. + MAX = 2L*sys.maxint+1 + return "<%s %r at %#x>" % (self.__class__.__name__,self.name, + id(self)&MAX) def frombuf(cls, buf): """Construct a TarInfo object from a 512 byte string buffer. diff --git a/Lib/xml/dom/minidom.py b/Lib/xml/dom/minidom.py index a5ebe5f7e3a1..45e9c068d7c7 100644 --- a/Lib/xml/dom/minidom.py +++ b/Lib/xml/dom/minidom.py @@ -14,6 +14,7 @@ Todo: * SAX 2 namespaces """ +import sys import xml.dom from xml.dom import EMPTY_NAMESPACE, EMPTY_PREFIX, XMLNS_NAMESPACE, domreg @@ -794,7 +795,10 @@ class Element(Node): self, namespaceURI, localName, NodeList()) def __repr__(self): - return "" % (self.tagName, id(self)) + # On some systems (RH10) id() can be a negative number. + # work around this. + MAX = 2L*sys.maxint+1 + return "" % (self.tagName, id(self)&MAX) def writexml(self, writer, indent="", addindent="", newl=""): # indent = current indentation