[meld] misc: Make fallback_decode handle getting an unexpected unicode



commit 94cef69dd107b70a2eff03b885891b701d751789
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Sat Jun 20 08:36:33 2015 +1000

    misc: Make fallback_decode handle getting an unexpected unicode

 meld/misc.py |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
---
diff --git a/meld/misc.py b/meld/misc.py
index 7cca650..9521791 100644
--- a/meld/misc.py
+++ b/meld/misc.py
@@ -154,6 +154,9 @@ def fallback_decode(bytes, encodings, lossy=False):
     If lossy is True, then decode errors will be replaced. This may be
     reasonable when the string is for display only.
     """
+    if isinstance(bytes, unicode):
+        return bytes
+
     for encoding in encodings:
         try:
             return bytes.decode(encoding)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]