mirror of
https://github.com/python/cpython.git
synced 2025-07-27 21:24:32 +00:00
#7930: fix stripid
This commit is contained in:
parent
6dfe66298b
commit
e511fc7979
2 changed files with 14 additions and 3 deletions
|
@ -124,9 +124,7 @@ _re_stripid = re.compile(r' at 0x[0-9a-f]{6,16}(>+)$', 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
|
||||
return _re_stripid.sub(r'\1', text)
|
||||
|
||||
def _is_some_method(obj):
|
||||
return inspect.ismethod(obj) or inspect.ismethoddescriptor(obj)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue