summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2009-08-13 19:34:07 +0000
committerZac Medico <zmedico@gentoo.org>2009-08-13 19:34:07 +0000
commit01550dbb932439aef6167bbbf017f4ea2400a52d (patch)
treecd541b11b4acf02576e4e2f1ac09488f41bed287
parentdbe11e93f1ab109f2bf16caa3fccc6bdaad49d81 (diff)
downloadportage-01550dbb932439aef6167bbbf017f4ea2400a52d.tar.gz
portage-01550dbb932439aef6167bbbf017f4ea2400a52d.tar.bz2
portage-01550dbb932439aef6167bbbf017f4ea2400a52d.zip
Add py3k support to _unicode_decode().
svn path=/main/trunk/; revision=14016
-rw-r--r--pym/portage/__init__.py9
1 files changed, 7 insertions, 2 deletions
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):