Skip to content

Commit 6f26357

Browse files
miss-islingtonivanbelenkyefimov-mikhailned-deilyFFY00
authored
[3.14] Synced docs and docstring for sysconfig.get_platform (GH-135530) (#138976)
Synced docs and docstring for `sysconfig.get_platform` (GH-135530) (cherry picked from commit 01cc532) Co-authored-by: ivan <[email protected]> Co-authored-by: Mikhail Efimov <[email protected]> Co-authored-by: Ned Deily <[email protected]> Co-authored-by: Filipe Laíns 🇵🇸 <[email protected]>
1 parent ec97866 commit 6f26357

File tree

3 files changed

+26
-18
lines changed

3 files changed

+26
-18
lines changed

Doc/library/sysconfig.rst

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -382,22 +382,19 @@ Other functions
382382

383383
Examples of returned values:
384384

385-
- linux-i586
386-
- linux-alpha (?)
387-
- solaris-2.6-sun4u
388385

389-
Windows will return one of:
386+
Windows:
390387

391388
- win-amd64 (64-bit Windows on AMD64, aka x86_64, Intel64, and EM64T)
392389
- win-arm64 (64-bit Windows on ARM64, aka AArch64)
393390
- win32 (all others - specifically, sys.platform is returned)
394391

395-
macOS can return:
392+
POSIX based OS:
396393

397-
- macosx-10.6-ppc
398-
- macosx-10.4-ppc64
399-
- macosx-10.3-i386
400-
- macosx-10.4-fat
394+
- linux-x86_64
395+
- macosx-15.5-arm64
396+
- macosx-26.0-universal2 (macOS on Apple Silicon or Intel)
397+
- android-24-arm64_v8a
401398

402399
For other non-POSIX platforms, currently just returns :data:`sys.platform`.
403400

Lib/sysconfig/__init__.py

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -650,18 +650,22 @@ def get_platform():
650650
isn't particularly important.
651651
652652
Examples of returned values:
653-
linux-i586
654-
linux-alpha (?)
655-
solaris-2.6-sun4u
656653
657-
Windows will return one of:
658-
win-amd64 (64-bit Windows on AMD64 (aka x86_64, Intel64, EM64T, etc)
659-
win-arm64 (64-bit Windows on ARM64 (aka AArch64)
660-
win32 (all others - specifically, sys.platform is returned)
661654
662-
For other non-POSIX platforms, currently just returns 'sys.platform'.
655+
Windows:
663656
664-
"""
657+
- win-amd64 (64-bit Windows on AMD64, aka x86_64, Intel64, and EM64T)
658+
- win-arm64 (64-bit Windows on ARM64, aka AArch64)
659+
- win32 (all others - specifically, sys.platform is returned)
660+
661+
POSIX based OS:
662+
663+
- linux-x86_64
664+
- macosx-15.5-arm64
665+
- macosx-26.0-universal2 (macOS on Apple Silicon or Intel)
666+
- android-24-arm64_v8a
667+
668+
For other non-POSIX platforms, currently just returns :data:`sys.platform`."""
665669
if os.name == 'nt':
666670
if 'amd64' in sys.version.lower():
667671
return 'win-amd64'

Lib/test/test_sysconfig.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,13 @@ def test_get_platform(self):
353353

354354
self.assertEqual(get_platform(), 'macosx-10.4-%s' % arch)
355355

356+
for macver in range(11, 16):
357+
_osx_support._remove_original_values(get_config_vars())
358+
get_config_vars()['CFLAGS'] = ('-fno-strict-overflow -Wsign-compare -Wunreachable-code'
359+
'-arch arm64 -fno-common -dynamic -DNDEBUG -g -O3 -Wall')
360+
get_config_vars()['MACOSX_DEPLOYMENT_TARGET'] = f"{macver}.0"
361+
self.assertEqual(get_platform(), 'macosx-%d.0-arm64' % macver)
362+
356363
# linux debian sarge
357364
os.name = 'posix'
358365
sys.version = ('2.3.5 (#1, Jul 4 2007, 17:28:59) '

0 commit comments

Comments
 (0)