From: Zac Medico Date: Thu, 13 Aug 2009 19:34:07 +0000 (-0000) Subject: Add py3k support to _unicode_decode(). X-Git-Tag: v2.2_rc39~89 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=01550dbb932439aef6167bbbf017f4ea2400a52d;p=portage.git Add py3k support to _unicode_decode(). svn path=/main/trunk/; revision=14016 --- 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):