diff --git a/_pytest/compat.py b/_pytest/compat.py index 09f681c86..e097dee51 100644 --- a/_pytest/compat.py +++ b/_pytest/compat.py @@ -189,7 +189,9 @@ def get_real_func(obj): else: raise ValueError( ("could not find real function of {start}" - "\nstopped at {current}").format(start=start_obj, current=obj)) + "\nstopped at {current}").format( + start=py.io.saferepr(start_obj), + current=py.io.saferepr(obj))) if isinstance(obj, functools.partial): obj = obj.func return obj