1 |
Do not assume that token_class returns a basestring. |
2 |
|
3 |
X-Gentoo-Bug: 541198 |
4 |
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=541198 |
5 |
--- |
6 |
pym/portage/dep/__init__.py | 6 ++++-- |
7 |
1 file changed, 4 insertions(+), 2 deletions(-) |
8 |
|
9 |
diff --git a/pym/portage/dep/__init__.py b/pym/portage/dep/__init__.py |
10 |
index e2e416c..a8c748d 100644 |
11 |
--- a/pym/portage/dep/__init__.py |
12 |
+++ b/pym/portage/dep/__init__.py |
13 |
@@ -558,7 +558,8 @@ def use_reduce(depstr, uselist=[], masklist=[], matchall=False, excludeall=[], i |
14 |
stack[level].extend(l) |
15 |
continue |
16 |
|
17 |
- if stack[level]: |
18 |
+ if stack[level] and isinstance(stack[level][-1], |
19 |
+ basestring): |
20 |
if stack[level][-1] == "||" and not l: |
21 |
#Optimize: || ( ) -> . |
22 |
stack[level].pop() |
23 |
@@ -583,7 +584,8 @@ def use_reduce(depstr, uselist=[], masklist=[], matchall=False, excludeall=[], i |
24 |
#ends in a non-operator. This is almost equivalent to stack[level][-1]=="||", |
25 |
#expect that it skips empty levels. |
26 |
while k>=0: |
27 |
- if stack[k]: |
28 |
+ if stack[k] and isinstance(stack[k][-1], |
29 |
+ basestring): |
30 |
if stack[k][-1] == "||": |
31 |
return k |
32 |
elif stack[k][-1][-1] != "?": |
33 |
-- |
34 |
2.0.5 |