diff --git a/Doc/library/sys.rst b/Doc/library/sys.rst index 54281a3f9a0c155..fa37d97a1531e17 100644 --- a/Doc/library/sys.rst +++ b/Doc/library/sys.rst @@ -999,8 +999,13 @@ always available. Windows ``'win32'`` Windows/Cygwin ``'cygwin'`` Mac OS X ``'darwin'`` + Android ``'android'`` ================ =========================== + .. versionchanged:: 3.7 + On Android, :attr:`sys.platform` is now equal to ``"android"`` rather + than ``'linux'``. + .. versionchanged:: 3.3 On Linux, :attr:`sys.platform` doesn't contain the major version anymore. It is always ``'linux'``, instead of ``'linux2'`` or ``'linux3'``. Since diff --git a/Misc/NEWS.d/next/Library/2018-01-24-00-52-55.bpo-32637.ntAPTa.rst b/Misc/NEWS.d/next/Library/2018-01-24-00-52-55.bpo-32637.ntAPTa.rst new file mode 100644 index 000000000000000..e1a346b875851b5 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2018-01-24-00-52-55.bpo-32637.ntAPTa.rst @@ -0,0 +1 @@ +Set sys.platform to "android" on Android. diff --git a/Python/getplatform.c b/Python/getplatform.c index 81a0f7ac5378bd5..f0408420444d9f5 100644 --- a/Python/getplatform.c +++ b/Python/getplatform.c @@ -5,6 +5,12 @@ #define PLATFORM "unknown" #endif +/* bpo-32637: Force sys.platform == "android" on Android */ +#ifdef __ANDROID__ +# undef PLATFORM +# define PLATFORM "android" +#endif + const char * Py_GetPlatform(void) {