diff options
author | Brett Cannon <bcannon@gmail.com> | 2004-06-19 01:02:51 (GMT) |
---|---|---|
committer | Brett Cannon <bcannon@gmail.com> | 2004-06-19 01:02:51 (GMT) |
commit | c6c1f478d9236ed92312f55b0421497b4f86a302 (patch) | |
tree | dd6e65e2291e9c778c48ffc21ce5cc9f119154a6 /Lib/pydoc.py | |
parent | 2b2fe94cde439e020ec2a5152e3d3e1dfec6ce9d (diff) | |
download | cpython-c6c1f478d9236ed92312f55b0421497b4f86a302.zip cpython-c6c1f478d9236ed92312f55b0421497b4f86a302.tar.gz cpython-c6c1f478d9236ed92312f55b0421497b4f86a302.tar.bz2 |
pydoc.stripid() is now case-insensitive for its regex to support platforms that
have pointer addresses in uppercase.
Closes bug #934282. Thanks Robin Becker.
Diffstat (limited to 'Lib/pydoc.py')
-rwxr-xr-x | Lib/pydoc.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Lib/pydoc.py b/Lib/pydoc.py index 90bb94c..ea2d97c 100755 --- a/Lib/pydoc.py +++ b/Lib/pydoc.py @@ -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 = {} |