From: Zac Medico Date: Tue, 4 Aug 2009 19:40:57 +0000 (-0000) Subject: Bug #280269 - Fix Atom.__str__ so that it doesn't try to encode a unicode X-Git-Tag: v2.2_rc36~12 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=8a2c435913dfd077adfca4e666e1f9c28bc04efe;p=portage.git Bug #280269 - Fix Atom.__str__ so that it doesn't try to encode a unicode string (resulting in UnicodeEncodeError). If an Atom instance is passed into the constructor, just return the given instance. svn path=/main/trunk/; revision=13905 --- diff --git a/pym/portage/dep.py b/pym/portage/dep.py index 64215b68c..f36f78256 100644 --- a/pym/portage/dep.py +++ b/pym/portage/dep.py @@ -494,6 +494,8 @@ class _AtomCache(type): identical instances when available. """ def __call__(cls, s): + if isinstance(s, Atom): + return s instance = cls._atoms.get(s) if instance is None: instance = super(_AtomCache, cls).__call__(s) @@ -620,7 +622,7 @@ class Atom(object): return repr(self._str) def __str__(self): - return str(self._str) + return self._str def endswith(self, *pargs, **kargs): return self._str.endswith(*pargs, **kargs)