public inbox for gentoo-portage-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-portage-dev] [PATCH] use_reduce: support non-string token_class (bug 541198)
@ 2015-02-24  5:35 Zac Medico
  2015-02-24 15:49 ` Brian Dolbec
  0 siblings, 1 reply; 2+ messages in thread
From: Zac Medico @ 2015-02-24  5:35 UTC (permalink / raw
  To: gentoo-portage-dev; +Cc: Zac Medico

Do not assume that token_class returns a basestring.

X-Gentoo-Bug: 541198
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=541198
---
 pym/portage/dep/__init__.py | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/pym/portage/dep/__init__.py b/pym/portage/dep/__init__.py
index e2e416c..a8c748d 100644
--- a/pym/portage/dep/__init__.py
+++ b/pym/portage/dep/__init__.py
@@ -558,7 +558,8 @@ def use_reduce(depstr, uselist=[], masklist=[], matchall=False, excludeall=[], i
 						stack[level].extend(l)
 					continue
 
-				if stack[level]:
+				if stack[level] and isinstance(stack[level][-1],
+					basestring):
 					if stack[level][-1] == "||" and not l:
 						#Optimize: || ( ) -> .
 						stack[level].pop()
@@ -583,7 +584,8 @@ def use_reduce(depstr, uselist=[], masklist=[], matchall=False, excludeall=[], i
 					#ends in a non-operator. This is almost equivalent to stack[level][-1]=="||",
 					#expect that it skips empty levels.
 					while k>=0:
-						if stack[k]:
+						if stack[k] and isinstance(stack[k][-1],
+							basestring):
 							if stack[k][-1] == "||":
 								return k
 							elif stack[k][-1][-1] != "?":
-- 
2.0.5



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-02-24 15:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-24  5:35 [gentoo-portage-dev] [PATCH] use_reduce: support non-string token_class (bug 541198) Zac Medico
2015-02-24 15:49 ` Brian Dolbec

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox