From 01550dbb932439aef6167bbbf017f4ea2400a52d Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Thu, 13 Aug 2009 19:34:07 +0000 Subject: Add py3k support to _unicode_decode(). svn path=/main/trunk/; revision=14016 --- pym/portage/__init__.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'pym') diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py index b28a091cf..79b0508c5 100644 --- a/pym/portage/__init__.py +++ b/pym/portage/__init__.py @@ -123,8 +123,13 @@ def _unicode_encode(s): return s def _unicode_decode(s): - if not isinstance(s, unicode) and isinstance(s, basestring): - s = unicode(s, encoding='utf_8', errors='replace') + if not isinstance(s, unicode): + if sys.hexversion < 0x3000000: + if isinstance(s, basestring): + s = unicode(s, encoding='utf_8', errors='replace') + else: + if isinstance(s, bytes): + s = unicode(s, encoding='utf_8', errors='replace') return s class _unicode_func_wrapper(object): -- cgit v1.2.3-1-g7c22