[issue8292] Incorrect condition test in platform.py

Marc-Andre Lemburg report at bugs.python.org
Sat Apr 3 14:36:15 CEST 2010


Marc-Andre Lemburg <mal at egenix.com> added the comment:

A.M. Kuchling wrote:
> 
> New submission from A.M. Kuchling <lists at amk.ca>:
> 
> While looking at #4440, I grepped for similar problems and found one in
> platform.py in the following line:
> 
> if no_os_uname or not filter(None, (system, node, release, version, machine))
> 
> In 3.x, filter() returns an object, not a list, so 'not filter()' will always be false.  
> 
> One fix is to either convert filter's output by adding list() or tuple(). Another fix could be 'not any ((system, node, release, version, machine))', but I don't know if platform.py is trying to stay compatible with versions of Python that lack any().

I'm trying to keep platform.py compatible with all Python versions
since 2.3, so using the list() wrapper appears to be the better
solution.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue8292>
_______________________________________


More information about the Python-bugs-list mailing list