FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-131032: Add support.linked_to_musl() function by vstinner · Pull Request #131071 · python/cpython · GitHub

/ cpython Public
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (3) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
19 changes: 19 additions & 0 deletions Lib/test/support/__init__.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -3015,3 +3015,22 @@ def is_libssl_fips_mode():
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)
3 changes: 2 additions & 1 deletion Lib/test/test_math.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -2763,7 +2763,8 @@ def test_fma_infinities(self):
# 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]
Expand Down
4 changes: 4 additions & 0 deletions Lib/test/test_support.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -744,6 +744,10 @@ def test_get_signal_name(self):
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
Expand Down

Back | FazBrowse Home | New Git URL