Gentoo Archives: gentoo-portage-dev

From: Zac Medico <zmedico@g.o>
To: gentoo-portage-dev@l.g.o
Cc: Zac Medico <zmedico@g.o>
Subject: [gentoo-portage-dev] [PATCH] use_reduce: reserve missing_white_space_check for invalid tokens (bug 611838)
Date: Mon, 06 Mar 2017 20:52:06
Message-Id: 20170306205108.23563-1-zmedico@gentoo.org
1 Since it's possible for a URI to contain parenthesis, only call
2 missing_white_space_check for tokens that fail to validate with
3 token_class. The missing_white_space_check function only serves
4 to clarify exception messages, so it must not be allowed to
5 reject valid tokens.
6 ---
7 pym/portage/dep/__init__.py | 4 ++--
8 1 file changed, 2 insertions(+), 2 deletions(-)
9
10 diff --git a/pym/portage/dep/__init__.py b/pym/portage/dep/__init__.py
11 index 968ff5b..6ff6adc 100644
12 --- a/pym/portage/dep/__init__.py
13 +++ b/pym/portage/dep/__init__.py
14 @@ -677,8 +677,6 @@ def use_reduce(depstr, uselist=[], masklist=[], matchall=False, excludeall=[], i
15 need_simple_token = True
16 stack[level].append(token)
17 else:
18 - missing_white_space_check(token, pos)
19 -
20 if need_bracket:
21 raise InvalidDependString(
22 _("expected: '(', got: '%s', token %s") % (token, pos+1))
23 @@ -698,12 +696,14 @@ def use_reduce(depstr, uselist=[], masklist=[], matchall=False, excludeall=[], i
24 token = token_class(token, eapi=eapi,
25 is_valid_flag=is_valid_flag)
26 except InvalidAtom as e:
27 + missing_white_space_check(token, pos)
28 raise InvalidDependString(
29 _("Invalid atom (%s), token %s") \
30 % (e, pos+1), errors=(e,))
31 except SystemExit:
32 raise
33 except Exception as e:
34 + missing_white_space_check(token, pos)
35 raise InvalidDependString(
36 _("Invalid token '%s', token %s") % (token, pos+1))
37
38 --
39 2.10.2

Replies