]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
Use the appropriate version of ''.join() in _merge_prefix
authorBen Darnell <ben@bendarnell.com>
Thu, 24 Feb 2011 23:17:41 +0000 (15:17 -0800)
committerBen Darnell <ben@bendarnell.com>
Thu, 24 Feb 2011 23:17:41 +0000 (15:17 -0800)
tornado/iostream.py

index aab967802051f05bc79d587b1dc82622fcbead78..150b05f963852dd37438a0ff6ba1b7892f0975dc 100644 (file)
@@ -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