Bug #280269 - Fix Atom.__str__ so that it doesn't try to encode a unicode
authorZac Medico <zmedico@gentoo.org>
Tue, 4 Aug 2009 19:40:57 +0000 (19:40 -0000)
committerZac Medico <zmedico@gentoo.org>
Tue, 4 Aug 2009 19:40:57 +0000 (19:40 -0000)
string (resulting in UnicodeEncodeError). If an Atom instance is passed into
the constructor, just return the given instance.

svn path=/main/trunk/; revision=13905

pym/portage/dep.py

index 64215b68c800aa018c15890536d5831d4f04e4bd..f36f7825652ee073602b9361ce3304d2599e9869 100644 (file)
@@ -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)