]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-114490: Add check for Mach-O linkage in Lib/platform.py (#114491)
authorAiden Fox Ivey <aiden@fox-ivey.com>
Fri, 26 Jan 2024 20:36:50 +0000 (15:36 -0500)
committerGitHub <noreply@github.com>
Fri, 26 Jan 2024 20:36:50 +0000 (21:36 +0100)
``platform.architecture()`` now returns the format of binaries (e.g. Mach-O) instead of the default empty string.

Co-authored-by: AN Long <aisk@users.noreply.github.com>
Lib/platform.py
Misc/NEWS.d/next/macOS/2024-01-23-11-35-26.gh-issue-114490.FrQOQ0.rst [new file with mode: 0644]

index 75aa55510858fd46ee1ab687e83699a88f3c3eca..b56472235ee9e420a1d93bcbc594541907dcb8f9 100755 (executable)
@@ -752,6 +752,8 @@ def architecture(executable=sys.executable, bits='', linkage=''):
     # Linkage
     if 'ELF' in fileout:
         linkage = 'ELF'
+    elif 'Mach-O' in fileout:
+        linkage = "Mach-O"
     elif 'PE' in fileout:
         # E.g. Windows uses this format
         if 'Windows' in fileout:
diff --git a/Misc/NEWS.d/next/macOS/2024-01-23-11-35-26.gh-issue-114490.FrQOQ0.rst b/Misc/NEWS.d/next/macOS/2024-01-23-11-35-26.gh-issue-114490.FrQOQ0.rst
new file mode 100644 (file)
index 0000000..abd296f
--- /dev/null
@@ -0,0 +1 @@
+Add Mach-O linkage support for :func:`platform.architecture()`.