From 3a3ad1ec7bf9730a8050433a240dcfbf59b14906 Mon Sep 17 00:00:00 2001
From: Vincent Pelletier <vincent@nexedi.com>
Date: Wed, 22 Jun 2011 14:33:34 +0000
Subject: [PATCH] Avoid emitting unicode.

For some reason res list can contain unicode strings (requinfo maybe).
This makes manage_debug_thread return a raw unicode object, which is
unreadable. So, if a unicode object is found, encode it as utf-8.
---
 product/DeadlockDebugger/dumper.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/product/DeadlockDebugger/dumper.py b/product/DeadlockDebugger/dumper.py
index 2334905cb4..4fe8b83b8a 100644
--- a/product/DeadlockDebugger/dumper.py
+++ b/product/DeadlockDebugger/dumper.py
@@ -70,7 +70,10 @@ def dump_threads():
 
     frames = None
     res.append("End of dump")
-    return '\n'.join(res)
+    result = '\n'.join(res)
+    if isinstance(result, unicode):
+      result = result.encode('utf-8')
+    return result
 
 config = getConfiguration()
 deadlockdebugger = config.product_config.get('deadlockdebugger')
-- 
2.30.9