From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 8FC91138A87 for ; Tue, 24 Feb 2015 15:49:08 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 4D0DDE0882; Tue, 24 Feb 2015 15:49:07 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id C5B78E083C for ; Tue, 24 Feb 2015 15:49:06 +0000 (UTC) Received: from big_daddy.dol-sen.ca (S010634bdfa9ecf80.vc.shawcable.net [96.49.31.57]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: dolsen) by smtp.gentoo.org (Postfix) with ESMTPSA id 613D6340839 for ; Tue, 24 Feb 2015 15:49:05 +0000 (UTC) Date: Tue, 24 Feb 2015 07:49:00 -0800 From: Brian Dolbec To: gentoo-portage-dev@lists.gentoo.org Subject: Re: [gentoo-portage-dev] [PATCH] use_reduce: support non-string token_class (bug 541198) Message-ID: <20150224074900.5da157a7.dolsen@gentoo.org> In-Reply-To: <1424756138-14836-1-git-send-email-zmedico@gentoo.org> References: <1424756138-14836-1-git-send-email-zmedico@gentoo.org> Organization: Gentoo Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-portage-dev@lists.gentoo.org Reply-to: gentoo-portage-dev@lists.gentoo.org MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Archives-Salt: 0cf97319-95c9-46e8-8eb8-cbcfba63fff2 X-Archives-Hash: 32d30e6866b7562067fcbc2feedae83c On Mon, 23 Feb 2015 21:35:38 -0800 Zac Medico wrote: > 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] != "?": That was fast. I didn't think you were even online last night ;) I was going to look at it closer this morning, figured it would be something like this to fix. LGTM, merge please -- Brian Dolbec