From e0bc361e32fcc4340bf31289f95e72cfa9ca1ed1 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Mon, 21 Sep 2009 14:47:40 +0000 Subject: [PATCH] Fix breakage in _unicode_encode() for non-string types. svn path=/main/trunk/; revision=14323 --- pym/portage/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 -- 2.26.2