--- managers-3.5.old.py 2017-08-09 15:03:38.000000000 -0500 +++ managers-3.5.py 2017-08-09 15:07:58.000000000 -0500 @@ -85,12 +85,15 @@ def convert_to_error(kind, result): if kind == '#ERROR': return result - elif kind == '#TRACEBACK': - assert type(result) is str - return RemoteError(result) - elif kind == '#UNSERIALIZABLE': - assert type(result) is str - return RemoteError('Unserializable message: %s\n' % result) + elif kind in ('#TRACEBACK', '#UNSERIALIZABLE'): + if not isinstance(result, str): + raise SystemError( + "Result {0!r} (kind '{1}') type is {2}, not str".format( + result, kind, type(result))) + if kind == '#UNSERIALIZABLE': + return RemoteError('Unserializable message: %s\n' % result) + else: + return RemoteError(result) else: return ValueError('Unrecognized message type')