diff options
-rw-r--r-- | pym/portage/__init__.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py index e3fee8084..fe696b6dc 100644 --- a/pym/portage/__init__.py +++ b/pym/portage/__init__.py @@ -142,7 +142,10 @@ if _encodings['merge'] is None: def _unicode_encode(s, encoding=_encodings['content'], errors='backslashreplace'): - if not isinstance(s, bytes): + if sys.hexversion >= 0x3000000: + if isinstance(s, str): + s = s.encode(encoding, errors) + elif isinstance(s, unicode): s = s.encode(encoding, errors) return s |