]> granicus.if.org Git - python/commitdiff
pydoc.stripid() is now case-insensitive for its regex to support platforms that
authorBrett Cannon <bcannon@gmail.com>
Sat, 19 Jun 2004 01:02:51 +0000 (01:02 +0000)
committerBrett Cannon <bcannon@gmail.com>
Sat, 19 Jun 2004 01:02:51 +0000 (01:02 +0000)
have pointer addresses in uppercase.

Closes bug #934282.  Thanks Robin Becker.

Lib/pydoc.py
Misc/ACKS
Misc/NEWS

index 90bb94cd3e23b820c86f0de3e33b3a51d27b9367..ea2d97c9afbca38ebe38de3d8e7e61d8cd91eee3 100755 (executable)
@@ -113,16 +113,16 @@ def cram(text, maxlen):
         return text[:pre] + '...' + text[len(text)-post:]
     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; 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)
+    # 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(object):
-    return inspect.ismethod(object) or inspect.ismethoddescriptor(object)
+def _is_some_method(obj):
+    return inspect.ismethod(obj) or inspect.ismethoddescriptor(obj)
 
 def allmethods(cl):
     methods = {}
index 480a1ec1eb0cdf9a15917f30ee99968086dd726e..61f857b46ca0e73dc03611bb6a7205e990561df6 100644 (file)
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -43,6 +43,7 @@ Samuel L. Bayer
 Donald Beaudry
 David Beazley
 Neal Becker
+Robin Becker
 Bill Bedford
 Reimer Behrends
 Thomas Bellman
index 3619c47d79570510324ec7eb48c47aa48f270abe..566cb0a35e79a56f286d03041e01d26ef508f0e8 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -336,8 +336,10 @@ Extension modules
 Library
 -------
 
+- Bug #934282: pydoc.stripid() is now case-insensitive.  Thanks Robin Becker.
+
 - Bug #823209:  cmath.log() now takes an optional base argument so that its
-  API matches math.log().                                                                  
+  API matches math.log().
 
 - Bug #957381: distutils bdist_rpm no longer fails on recent RPM versions
   that generate a *-debuginfo.rpm.