except ImportError:
return False # more of a maybe, unless we add this to the _ssl module.
return get_fips_mode() != 0
+
+
+def linked_to_musl():
+ """
+ Test if the Python executable is linked to the musl C library.
+ """
+ if sys.platform != 'linux':
+ return False
+
+ import subprocess
+ exe = getattr(sys, '_base_executable', sys.executable)
+ cmd = ['ldd', exe]
+ try:
+ stdout = subprocess.check_output(cmd,
+ text=True,
+ stderr=subprocess.STDOUT)
+ except (OSError, subprocess.CalledProcessError):
+ return False
+ return ('musl' in stdout)
# properly: it doesn't use the right sign when the result is zero.
@unittest.skipIf(
sys.platform.startswith(("freebsd", "wasi", "netbsd", "emscripten"))
- or (sys.platform == "android" and platform.machine() == "x86_64"),
+ or (sys.platform == "android" and platform.machine() == "x86_64")
+ or support.linked_to_musl(), # gh-131032
f"this platform doesn't implement IEE 754-2008 properly")
def test_fma_zero_result(self):
nonnegative_finites = [0.0, 1e-300, 2.3, 1e300]
self.assertEqual(support.get_signal_name(exitcode), expected,
exitcode)
+ def test_linked_to_musl(self):
+ linked = support.linked_to_musl()
+ self.assertIsInstance(linked, bool)
+
# XXX -follows a list of untested API
# make_legacy_pyc
# is_resource_enabled