1 |
Author: zmedico |
2 |
Date: 2009-08-04 19:40:57 +0000 (Tue, 04 Aug 2009) |
3 |
New Revision: 13905 |
4 |
|
5 |
Modified: |
6 |
main/trunk/pym/portage/dep.py |
7 |
Log: |
8 |
Bug #280269 - Fix Atom.__str__ so that it doesn't try to encode a unicode |
9 |
string (resulting in UnicodeEncodeError). If an Atom instance is passed into |
10 |
the constructor, just return the given instance. |
11 |
|
12 |
|
13 |
Modified: main/trunk/pym/portage/dep.py |
14 |
=================================================================== |
15 |
--- main/trunk/pym/portage/dep.py 2009-08-04 19:27:24 UTC (rev 13904) |
16 |
+++ main/trunk/pym/portage/dep.py 2009-08-04 19:40:57 UTC (rev 13905) |
17 |
@@ -494,6 +494,8 @@ |
18 |
identical instances when available. |
19 |
""" |
20 |
def __call__(cls, s): |
21 |
+ if isinstance(s, Atom): |
22 |
+ return s |
23 |
instance = cls._atoms.get(s) |
24 |
if instance is None: |
25 |
instance = super(_AtomCache, cls).__call__(s) |
26 |
@@ -620,7 +622,7 @@ |
27 |
return repr(self._str) |
28 |
|
29 |
def __str__(self): |
30 |
- return str(self._str) |
31 |
+ return self._str |
32 |
|
33 |
def endswith(self, *pargs, **kargs): |
34 |
return self._str.endswith(*pargs, **kargs) |