From 8a2c435913dfd077adfca4e666e1f9c28bc04efe Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Tue, 4 Aug 2009 19:40:57 +0000 Subject: 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 --- pym/portage/dep.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'pym') 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) -- cgit v1.2.3-1-g7c22