mirror of
https://github.com/python/cpython.git
synced 2025-08-01 07:33:08 +00:00
unittest.TestCase uses safe_repr for producing failure messages. Partial fix for issue 7956
This commit is contained in:
parent
456e1652cf
commit
225a099fe5
3 changed files with 72 additions and 46 deletions
|
@ -1,5 +1,11 @@
|
|||
"""Various utility functions."""
|
||||
|
||||
def safe_repr(obj):
|
||||
try:
|
||||
return repr(obj)
|
||||
except Exception:
|
||||
return object.__repr__(obj)
|
||||
|
||||
def strclass(cls):
|
||||
return "%s.%s" % (cls.__module__, cls.__name__)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue