From: Ben Darnell Date: Thu, 24 Feb 2011 23:17:41 +0000 (-0800) Subject: Use the appropriate version of ''.join() in _merge_prefix X-Git-Tag: v2.0.0~85^2~13 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a64ca0efc468d05683090df59b384a29a1472534;p=thirdparty%2Ftornado.git Use the appropriate version of ''.join() in _merge_prefix --- diff --git a/tornado/iostream.py b/tornado/iostream.py index aab967802..150b05f96 100644 --- a/tornado/iostream.py +++ b/tornado/iostream.py @@ -519,7 +519,13 @@ def _merge_prefix(deque, size): chunk = chunk[:remaining] prefix.append(chunk) remaining -= len(chunk) - deque.appendleft(b('').join(prefix)) + # This data structure normally just contains byte strings, but + # the unittest gets messy if it doesn't use the default str() type, + # so do the merge based on the type of data that's actually present. + if prefix: + deque.appendleft(type(prefix[0])().join(prefix)) + if not deque: + deque.appendleft(b("")) def doctests(): import doctest