Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 541198

Summary: portage.dep.use_reduce() with custom token_class: Potential TypeError
Product: Portage Development Reporter: Arfrever Frehtes Taifersar Arahesis <arfrever.fta>
Component: Core - DependenciesAssignee: Portage team <dev-portage>
Status: RESOLVED FIXED    
Severity: normal CC: zerochaos
Priority: Normal Keywords: InVCS
Version: unspecified   
Hardware: All   
OS: All   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 484436    

Description Arfrever Frehtes Taifersar Arahesis 2015-02-24 04:16:47 UTC
$ python -c $'import portage\ndef reduce_atom(atom, eapi, is_valid_flag): return None\nprint(portage.dep.use_reduce("a/a b/b"))'
['a/a', 'b/b']
$ python -c $'import portage\ndef reduce_atom(atom, eapi, is_valid_flag): return None\nprint(portage.dep.use_reduce("a/a b/b", token_class=reduce_atom))'
[None, None]
$ python -c $'import portage\ndef reduce_atom(atom, eapi, is_valid_flag): return None\nprint(portage.dep.use_reduce("a/a ( b/b )"))'
['a/a', 'b/b']
$ python -c $'import portage\ndef reduce_atom(atom, eapi, is_valid_flag): return None\nprint(portage.dep.use_reduce("a/a ( b/b )", token_class=reduce_atom))'
Traceback (most recent call last):
  File "<string>", line 3, in <module>
  File "/usr/lib64/python3.4/site-packages/portage/dep/__init__.py", line 565, in use_reduce
    elif stack[level][-1][-1] == "?":
TypeError: 'NoneType' object is not subscriptable
Comment 1 Zac Medico gentoo-dev 2015-02-24 05:38:31 UTC
There's a patch in the following branch:

	https://github.com/zmedico/portage/tree/bug_541198

I've posted it for review here:

	http://thread.gmane.org/gmane.linux.gentoo.portage.devel/5272
Comment 2 Zac Medico gentoo-dev 2015-02-24 17:43:55 UTC
This is in the master branch now:

https://github.com/gentoo/portage/commit/0887d95d288226c52c1d5610b514d41a624eadb7
Comment 3 Brian Dolbec (RETIRED) gentoo-dev 2015-03-04 21:47:02 UTC
Released in portage-2.2.18