This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author dmalcolm
Recipients Arfrever, Ramchandra Apte, amaury.forgeotdarc, barry, benjamin.peterson, djc, dmalcolm, doko, eric.araujo, ezio.melotti, foom, gagern, georg.brandl, jwilk, lemburg, loewis, petri.lehtinen, pitrou, python-dev, r.david.murray, rosslagerwall, sandro.tosi, vstinner
Date 2011-08-19.19:25:03
SpamBayes Score 7.96628e-11
Marked as misclassified No
Message-id <>
Note that PyPy is also affected by this issue; see

For CPython, I'm of the opinion that:
  - the final digit of sys.platform as-is for "linux*" is effectively meaningless
  - that no code should be relying on the final digit of sys.platform (thankfully this is now recommended by: )
  - unfortunately there is code out there that checks against "linux2" and thus does rely on this value
  - patching CPython to force this to read "linux2" may be necessary for some downstream distributors of Python, to maximize compatibility with such broken code.

For CPython, "sys.platform" currently reports on the difference between whether "uname" reported linux2 or linux3 at build time, which is currently meaningless (see msg142219 above about our chroot-ed build environment).

For example, in RHEL we may at some future time upgrade our build farm to linux 3, but still provision our build trees within it for linux 2; this may mean that our build farm starts reporting "linux3" when rebuilding security updates for python 2.2, 2.3, 2.4 or 2.6, even when building against kernel-2.*'s user-space.   If this happens, I'd be inclined to patch those builds of Python back to "linux2".  It would be entirely meaningless and only damaging for one of our security updates of, say, Python 2.2 to shift sys.platform from "linux2" to "linux3" simply because of the kernel that was running in the build environment (as opposed to the kernel headers exposed to the compiler, and other such aspects of the kernel exposed in user-space).

FWIW, my opinion is currently:
  - in 3.3, sys.platform on linux should be simply "linux"
  - for 2.7 and 3.2, sys.platform should be forced to "linux2" (and indeed, I anticipate doing this for earlier releases that I still maintain downstream)
  - existing documentation should say that on linux, sys.platform begins with "linux", and that programmers should avoid relying upon the suffix
  - I don't see the need for more adding access to more details of the build platform (and I can poke holes in any such plan, if anyone wants me to: what would it contain?  what about the case where the user-space files e.g. headers aren't the same as the uname?  etc)
Date User Action Args
2011-08-19 19:25:05dmalcolmsetrecipients: + dmalcolm, lemburg, loewis, barry, georg.brandl, doko, amaury.forgeotdarc, gagern, foom, pitrou, vstinner, benjamin.peterson, jwilk, djc, ezio.melotti, eric.araujo, Arfrever, r.david.murray, sandro.tosi, rosslagerwall, python-dev, petri.lehtinen, Ramchandra Apte
2011-08-19 19:25:04dmalcolmsetmessageid: <>
2011-08-19 19:25:04dmalcolmlinkissue12326 messages
2011-08-19 19:25:03dmalcolmcreate