[Python-checkins] python/dist/src/Lib pydoc.py,1.92,1.93

bcannon at users.sourceforge.net bcannon at users.sourceforge.net
Fri Jun 18 21:03:21 EDT 2004


Update of /cvsroot/python/python/dist/src/Lib
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8289/Lib

Modified Files:
	pydoc.py 
Log Message:
pydoc.stripid() is now case-insensitive for its regex to support platforms that
have pointer addresses in uppercase.

Closes bug #934282.  Thanks Robin Becker.


Index: pydoc.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/pydoc.py,v
retrieving revision 1.92
retrieving revision 1.93
diff -C2 -d -r1.92 -r1.93
*** pydoc.py	11 Jun 2004 04:46:12 -0000	1.92
--- pydoc.py	19 Jun 2004 01:02:43 -0000	1.93
***************
*** 114,127 ****
      return text
  
  def stripid(text):
      """Remove the hexadecimal id from a Python object representation."""
!     # The behaviour of %p is implementation-dependent; we check two cases.
!     for pattern in [' at 0x[0-9a-f]{6,}(>+)$', ' at [0-9A-F]{8,}(>+)$']:
!         if re.search(pattern, repr(Exception)):
!             return re.sub(pattern, '\\1', text)
      return text
  
! def _is_some_method(object):
!     return inspect.ismethod(object) or inspect.ismethoddescriptor(object)
  
  def allmethods(cl):
--- 114,127 ----
      return text
  
+ _re_stripid = re.compile(r' at 0x[0-9a-f]{6,}(>+)$', re.IGNORECASE)
  def stripid(text):
      """Remove the hexadecimal id from a Python object representation."""
!     # The behaviour of %p is implementation-dependent in terms of case.
!     if _re_stripid.search(repr(Exception)):
!         return _re_stripid.sub(r'\1', text)
      return text
  
! def _is_some_method(obj):
!     return inspect.ismethod(obj) or inspect.ismethoddescriptor(obj)
  
  def allmethods(cl):




More information about the Python-checkins mailing list