diff options
Diffstat (limited to 'Lib/unittest/util.py')
-rw-r--r-- | Lib/unittest/util.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/unittest/util.py b/Lib/unittest/util.py index 26805de..1c1b600 100644 --- a/Lib/unittest/util.py +++ b/Lib/unittest/util.py @@ -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__) |