From d040bb64be0c33a48dba09e3ba064ffcf697ed1e Mon Sep 17 00:00:00 2001 From: Mohamed Akram Date: Fri, 16 Oct 2026 20:30:25 +0400 Subject: [PATCH 1/2] gh-159550: Fix FreeBSD version in get_platform() --- Lib/sysconfig/__init__.py | 2 ++ Lib/test/test_sysconfig.py | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/Lib/sysconfig/__init__.py b/Lib/sysconfig/__init__.py index 0657e458806e9b..0f1674dae787d1 100644 --- a/Lib/sysconfig/__init__.py +++ b/Lib/sysconfig/__init__.py @@ -755,6 +755,8 @@ def get_platform(): osname, release, machine = _osx_support.get_platform_osx( get_config_vars(), osname, release, machine) + elif osname == "freebsd": + release = release.partition('-')[0] return '-'.join(map(str, filter(None, (osname, release, machine)))) diff --git a/Lib/test/test_sysconfig.py b/Lib/test/test_sysconfig.py index 6b90f2960672b6..3c67d04f175531 100644 --- a/Lib/test/test_sysconfig.py +++ b/Lib/test/test_sysconfig.py @@ -390,6 +390,16 @@ def test_get_platform(self): '#1 Tue Jan 9 20:35:43 UTC 2018', machine)) self.assertEqual(get_platform(), f'android-9-{abi}') + # FreeBSD + os.name = 'posix' + sys.platform = 'freebsd' + self._set_uname(( + 'FreeBSD', 'localhost', '15.1-RELEASE-p4', + 'FreeBSD 15.1-RELEASE-p4 releng/15.1-n283627-e38a7085f3a8 GENERIC', + 'amd64' + )) + self.assertEqual(get_platform(), 'freebsd-15.1-amd64') + # XXX more platforms to tests here @unittest.skipIf(is_wasi, "Incompatible with WASI mapdir and OOT builds") From c313046f4bd3b1b9adc3cd824fca48c41488b632 Mon Sep 17 00:00:00 2001 From: "blurb-it[bot]" <43283697+blurb-it[bot]@users.noreply.github.com> Date: Fri, 16 Oct 2026 16:44:17 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=93=9C=F0=9F=A4=96=20Added=20by=20blu?= =?UTF-8?q?rb=5Fit.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../next/Library/2026-10-16-16-44-15.gh-issue-159550.mrjZIG.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 Misc/NEWS.d/next/Library/2026-10-16-16-44-15.gh-issue-159550.mrjZIG.rst diff --git a/Misc/NEWS.d/next/Library/2026-10-16-16-44-15.gh-issue-159550.mrjZIG.rst b/Misc/NEWS.d/next/Library/2026-10-16-16-44-15.gh-issue-159550.mrjZIG.rst new file mode 100644 index 00000000000000..fc6170bed1b2b1 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2026-10-16-16-44-15.gh-issue-159550.mrjZIG.rst @@ -0,0 +1 @@ +On FreeBSD, :func:`sysconfig.get_platform` now omits the branch and patch level.