]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
pydoc.stripid() is now case-insensitive.
authorBrett Cannon <bcannon@gmail.com>
Sat, 19 Jun 2004 01:05:40 +0000 (01:05 +0000)
committerBrett Cannon <bcannon@gmail.com>
Sat, 19 Jun 2004 01:05:40 +0000 (01:05 +0000)
Closes bug #934282.  Thanks Robin Becker.

Lib/pydoc.py
Misc/ACKS
Misc/NEWS

index 267ff06103510354218269bf3ea7c1014b66ea1f..5c5102a3f5ed1cbf8772df720ad7adedbe79afbc 100755 (executable)
@@ -104,12 +104,12 @@ 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):
index 38763d134f8329442ac3d8614ab4bfb578164ff5..acb5fd83baf87bdd0a3761dcfd7d0ea01d4ff880 100644 (file)
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -42,6 +42,7 @@ Samuel L. Bayer
 Donald Beaudry
 David Beazley
 Neal Becker
+Robin Becker
 Bill Bedford
 Reimer Behrends
 Thomas Bellman
index b01488bca40ba22bf276f3314720d404484ca44c..757549b1ed6dcc20c0b6b166373aa743e99ab5c7 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -34,6 +34,11 @@ Extension modules
 - Bug #954364: inspect.getframeinfo() sometimes produces incorrect traceback
   line numbers
 
+Library
+-------
+
+- Bug #934282: make pydoc.stripid() be case-insensitive.
+
 What's New in Python 2.3.4 (final)?
 ===================================