[meld/Python3] meldbuffer: Enforce unicode filenames instead of coercing



commit c2b6904eec5d9f7c8b77cd8e8f74262024f45034
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Sun Jul 24 08:32:46 2016 +1000

    meldbuffer: Enforce unicode filenames instead of coercing
    
    All of the code paths to set this should already only handle unicode
    in Python 3 anyway, so this should be a no-op.

 meld/meldbuffer.py |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/meld/meldbuffer.py b/meld/meldbuffer.py
index 1dfb116..5fec841 100644
--- a/meld/meldbuffer.py
+++ b/meld/meldbuffer.py
@@ -14,6 +14,7 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
+import logging
 import sys
 
 from gi.repository import Gio
@@ -22,9 +23,10 @@ from gi.repository import GObject
 from gi.repository import GtkSource
 
 from meld.conf import _
-from meld.misc import fallback_decode
 from meld.settings import bind_settings, meldsettings
 
+log = logging.getLogger(__name__)
+
 
 class MeldBuffer(GtkSource.Buffer):
 
@@ -132,8 +134,10 @@ class MeldBufferData(GObject.GObject):
     def label(self, value):
         if not value:
             return
-        encodings = (sys.getfilesystemencoding(), 'utf8')
-        self._label = fallback_decode(value, encodings, lossy=True)
+        if not isinstance(value, str):
+            log.warning('Invalid label ignored "%r"', value)
+            return
+        self._label = value
 
     def _connect_monitor(self):
         if not self._gfile:


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