[issue12326] Linux 3: tests should avoid using sys.platform == 'linux2'

Charles-François Natali report at bugs.python.org
Fri Jul 22 00:15:33 CEST 2011


Charles-François Natali <neologix at free.fr> added the comment:

> Still -1. It should be renamed to 'linux' in future releases, and
> back-patched to 'linux2' for maintenance releases.
>

I really don't see any advantage to this solution:
- sys.platform currently has a clear and documented value (OS name +
major release), this change would break that
- sys.platform is actually really simple, it returns MACHDEP: this
change would require complicating the code
- code testing sys.platform for equality is already broken: there's
the exact same problem with FreeBSD, OpenBSD and any other operating
system I can think of: 99% of the time, people checking sys.platform
really mean sys.platform.startswith(<OS name>), os.uname()[0] or
platform.system(), i.e. the OS name, and don't care about the release
- this change would introduce an inconsistency between Python
releases, which would make the problem worse
- this information is already provided by os.uname() and platform.system()
- finally, this would not solve the problem at hand

> As for releases that are already out - users should be informed to
> not use those on Linux 3 (or not use Linux 3 on systems where they
> have the old Python releases).
>

Advise users to not use Python on Linux 3 - which doesn't break break
backward compatibility in any way - sounds like a really bad idea, and
would give Python a bad press for no reason.
I mean, it's just a version number, and a really minor bug:
Chromium and matplotlib already fixed this in their code using
sys.platform.startswith('linux') [1] [2].
It's that simple, I don't see what there's so much to talk about here.

[1] http://codereview.chromium.org/7172016
[2] https://github.com/matplotlib/matplotlib/commit/aaef94485cf71ed3181e0adc5577d1a8911f6544

----------

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


More information about the Python-bugs-list mailing list