[Python-checkins] python/dist/src/Lib repr.py,1.15,1.15.12.1

anthonybaxter at users.sourceforge.net anthonybaxter at users.sourceforge.net
Thu Nov 6 08:40:48 EST 2003


Update of /cvsroot/python/python/dist/src/Lib
In directory sc8-pr-cvs1:/tmp/cvs-serv12406/Lib

Modified Files:
      Tag: release23-maint
	repr.py 
Log Message:
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.


Index: repr.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/repr.py,v
retrieving revision 1.15
retrieving revision 1.15.12.1
diff -C2 -d -r1.15 -r1.15.12.1
*** repr.py	5 Feb 2003 18:29:33 -0000	1.15
--- repr.py	6 Nov 2003 13:40:45 -0000	1.15.12.1
***************
*** 3,6 ****
--- 3,8 ----
  __all__ = ["Repr","repr"]
  
+ import sys
+ 
  class Repr:
      def __init__(self):
***************
*** 102,107 ****
              # exceptions -- then make up something
          except:
!             return '<' + x.__class__.__name__ + ' instance at ' + \
!                       hex(id(x))[2:] + '>'
          if len(s) > self.maxstring:
              i = max(0, (self.maxstring-3)//2)
--- 104,111 ----
              # exceptions -- then make up something
          except:
!             # On some systems (RH10) id() can be a negative number. 
!             # work around this.
!             MAX = 2L*sys.maxint+1
!             return '<' + x.__class__.__name__ + ' instance at %x>'%(id(x)&MAX)
          if len(s) > self.maxstring:
              i = max(0, (self.maxstring-3)//2)





More information about the Python-checkins mailing list