]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.14] Synced docs and docstring for `sysconfig.get_platform` (GH-135530) (#138976)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Sat, 4 Oct 2025 14:55:25 +0000 (16:55 +0200)
committerGitHub <noreply@github.com>
Sat, 4 Oct 2025 14:55:25 +0000 (17:55 +0300)
Synced docs and docstring  for `sysconfig.get_platform` (GH-135530)
(cherry picked from commit 01cc53295cca6834de77be79368c25b890bab8fc)

Co-authored-by: ivan <ivandietert@gmail.com>
Co-authored-by: Mikhail Efimov <efimov.mikhail@gmail.com>
Co-authored-by: Ned Deily <nad@python.org>
Co-authored-by: Filipe Laíns 🇵🇸 <lains@riseup.net>
Doc/library/sysconfig.rst
Lib/sysconfig/__init__.py
Lib/test/test_sysconfig.py

index 684d14a74c48ab057970520623577c308f6d4a2d..532facb45f83a0e1360432ba3d8a76fa94e6e440 100644 (file)
@@ -382,22 +382,19 @@ Other functions
 
    Examples of returned values:
 
-   - linux-i586
-   - linux-alpha (?)
-   - solaris-2.6-sun4u
 
-   Windows will return one of:
+   Windows:
 
    - win-amd64 (64-bit Windows on AMD64, aka x86_64, Intel64, and EM64T)
    - win-arm64 (64-bit Windows on ARM64, aka AArch64)
    - win32 (all others - specifically, sys.platform is returned)
 
-   macOS can return:
+   POSIX based OS:
 
-   - macosx-10.6-ppc
-   - macosx-10.4-ppc64
-   - macosx-10.3-i386
-   - macosx-10.4-fat
+   - linux-x86_64
+   - macosx-15.5-arm64
+   - macosx-26.0-universal2 (macOS on Apple Silicon or Intel)
+   - android-24-arm64_v8a
 
    For other non-POSIX platforms, currently just returns :data:`sys.platform`.
 
index f93b98dd681536cd9b592aa5ec6642a46dd4a0b8..2ecbff222fe3a5cb731bb71435f8fa74914d9daf 100644 (file)
@@ -650,18 +650,22 @@ def get_platform():
     isn't particularly important.
 
     Examples of returned values:
-       linux-i586
-       linux-alpha (?)
-       solaris-2.6-sun4u
 
-    Windows will return one of:
-       win-amd64 (64-bit Windows on AMD64 (aka x86_64, Intel64, EM64T, etc)
-       win-arm64 (64-bit Windows on ARM64 (aka AArch64)
-       win32 (all others - specifically, sys.platform is returned)
 
-    For other non-POSIX platforms, currently just returns 'sys.platform'.
+    Windows:
 
-    """
+    - win-amd64 (64-bit Windows on AMD64, aka x86_64, Intel64, and EM64T)
+    - win-arm64 (64-bit Windows on ARM64, aka AArch64)
+    - win32 (all others - specifically, sys.platform is returned)
+
+    POSIX based OS:
+
+    - linux-x86_64
+    - macosx-15.5-arm64
+    - macosx-26.0-universal2 (macOS on Apple Silicon or Intel)
+    - android-24-arm64_v8a
+
+    For other non-POSIX platforms, currently just returns :data:`sys.platform`."""
     if os.name == 'nt':
         if 'amd64' in sys.version.lower():
             return 'win-amd64'
index 9faabc2e25447f2e095bc5ce4b612a2054530599..09eff11179ea58de93036e584339bc769a1359c5 100644 (file)
@@ -353,6 +353,13 @@ class TestSysConfig(unittest.TestCase, VirtualEnvironmentMixin):
 
             self.assertEqual(get_platform(), 'macosx-10.4-%s' % arch)
 
+        for macver in range(11, 16):
+            _osx_support._remove_original_values(get_config_vars())
+            get_config_vars()['CFLAGS'] = ('-fno-strict-overflow -Wsign-compare -Wunreachable-code'
+                                        '-arch arm64 -fno-common -dynamic -DNDEBUG -g -O3 -Wall')
+            get_config_vars()['MACOSX_DEPLOYMENT_TARGET'] = f"{macver}.0"
+            self.assertEqual(get_platform(), 'macosx-%d.0-arm64' % macver)
+
         # linux debian sarge
         os.name = 'posix'
         sys.version = ('2.3.5 (#1, Jul  4 2007, 17:28:59) '