File tree 3 files changed +26
-2
lines changed
Filter options
3 files changed +26
-2
lines changed
Original file line number Diff line number Diff line change @@ -2767,3 +2767,22 @@ def __iter__(self):
2767
2767
if self .iter_raises :
2768
2768
1 / 0
2769
2769
return self
2770
+
2771
+
2772
+ def linked_to_musl ():
2773
+ """
2774
+ Test if the Python executable is linked to the musl C library.
2775
+ """
2776
+ if sys .platform != 'linux' :
2777
+ return False
2778
+
2779
+ import subprocess
2780
+ exe = getattr (sys , '_base_executable' , sys .executable )
2781
+ cmd = ['ldd' , exe ]
2782
+ try :
2783
+ stdout = subprocess .check_output (cmd ,
2784
+ text = True ,
2785
+ stderr = subprocess .STDOUT )
2786
+ except (OSError , subprocess .CalledProcessError ):
2787
+ return False
2788
+ return ('musl' in stdout )
Original file line number Diff line number Diff line change @@ -2712,8 +2712,9 @@ def test_fma_infinities(self):
2712
2712
# gh-73468: On some platforms, libc fma() doesn't implement IEE 754-2008
2713
2713
# properly: it doesn't use the right sign when the result is zero.
2714
2714
@unittest .skipIf (
2715
- sys .platform .startswith (("freebsd" , "wasi" , "netbsd" ))
2716
- or (sys .platform == "android" and platform .machine () == "x86_64" ),
2715
+ sys .platform .startswith (("freebsd" , "wasi" , "netbsd" , "emscripten" ))
2716
+ or (sys .platform == "android" and platform .machine () == "x86_64" )
2717
+ or support .linked_to_musl (), # gh-131032
2717
2718
f"this platform doesn't implement IEE 754-2008 properly" )
2718
2719
def test_fma_zero_result (self ):
2719
2720
nonnegative_finites = [0.0 , 1e-300 , 2.3 , 1e300 ]
Original file line number Diff line number Diff line change @@ -733,6 +733,10 @@ def test_copy_python_src_ignore(self):
733
733
self .assertEqual (support .copy_python_src_ignore (path , os .listdir (path )),
734
734
ignored )
735
735
736
+ def test_linked_to_musl (self ):
737
+ linked = support .linked_to_musl ()
738
+ self .assertIsInstance (linked , bool )
739
+
736
740
# XXX -follows a list of untested API
737
741
# make_legacy_pyc
738
742
# is_resource_enabled
You can’t perform that action at this time.
0 commit comments