From 7a626b46df34cde1f44a143b7ebcb2ae3a58e9c5 Mon Sep 17 00:00:00 2001 From: Brett Cannon Date: Sat, 19 Jun 2004 01:05:40 +0000 Subject: [PATCH] pydoc.stripid() is now case-insensitive. Closes bug #934282. Thanks Robin Becker. --- Lib/pydoc.py | 8 ++++---- Misc/ACKS | 1 + Misc/NEWS | 5 +++++ 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/Lib/pydoc.py b/Lib/pydoc.py index 267ff0610351..5c5102a3f5ed 100755 --- a/Lib/pydoc.py +++ b/Lib/pydoc.py @@ -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): diff --git a/Misc/ACKS b/Misc/ACKS index 38763d134f83..acb5fd83baf8 100644 --- 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 diff --git a/Misc/NEWS b/Misc/NEWS index b01488bca40b..757549b1ed6d 100644 --- 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)? =================================== -- 2.47.3