Skip to content

Conversation

@vstinner
Copy link
Member

@vstinnervstinner commented Mar 11, 2025

Skip test_math.test_fma_zero_result() if Python is linked to the musl C library.

Skip test_math.test_fma_zero_result() if Python is linked to the musl C library.
@vstinner
Copy link
MemberAuthor

cc @mdickinson@skirpichev

@skirpichev
Copy link
Member

Looks fine. Is this reported to upstream (I can't find a bugreport)?

@vstinner
Copy link
MemberAuthor

Last year I reported a similar issue to FreeBSD: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=277783

Copy link
Contributor

@furkanonderfurkanonder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@vstinner
Copy link
MemberAuthor

Is this reported to upstream (I can't find a bugreport)?

I sent an email to https://www.openwall.com/lists/musl/ but my email is currently waiting for moderators (I suppose), it's not online yet.

@vstinner
Copy link
MemberAuthor

I sent an email to https://www.openwall.com/lists/musl/ but my email is currently waiting for moderators (I suppose), it's not online yet.

My bug report: https://www.openwall.com/lists/musl/2025/03/11/1

Copy link
Member

@skirpichevskirpichev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Is there some buildbot to trigger this "skipIf" (except for WASI)?

On another hand, maybe it's a good idea to add a workaround for handling zero arguments (like we have _Py_log1p(), I not sure it's still relevant).

@vstinner
Copy link
MemberAuthor

I proposed a different fix for test_math: #131134

@vstinnervstinner merged commit 68922ac into python:mainMar 13, 2025
46 checks passed
@miss-islington-app
Copy link

Thanks @vstinner for the PR 🌮🎉.. I'm working now to backport this PR to: 3.12, 3.13.
🐍🍒⛏🤖

@vstinnervstinner deleted the linked_to_musl branch March 13, 2025 09:33
@miss-islington-app
Copy link

Sorry, @vstinner, I could not cleanly backport this to 3.13 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker 68922ace4dabb6635e6d5b51bbe6485ef2e9dad2 3.13 

@miss-islington-app
Copy link

Sorry, @vstinner, I could not cleanly backport this to 3.12 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker 68922ace4dabb6635e6d5b51bbe6485ef2e9dad2 3.12 

@bedevere-app
Copy link

GH-131179 is a backport of this pull request to the 3.13 branch.

@bedevere-appbedevere-appbot removed the needs backport to 3.13 bugs and security fixes label Mar 13, 2025
vstinner added a commit to vstinner/cpython that referenced this pull request Mar 13, 2025
Skip test_math.test_fma_zero_result() if Python is linked to the musl C library. (cherry picked from commit 68922ac)
@vstinnervstinner removed the needs backport to 3.12 only security fixes label Mar 13, 2025
@vstinner
Copy link
MemberAuthor

@vstinner vstinner removed the needs backport to 3.12 label

Oops, math.fma() was added to Python 3.13.

vstinner added a commit that referenced this pull request Mar 13, 2025
…31179) gh-131032: Add support.linked_to_musl() function (#131071) Skip test_math.test_fma_zero_result() if Python is linked to the musl C library. (cherry picked from commit 68922ac)
bitdancer added a commit to bitdancer/cpython that referenced this pull request Mar 15, 2025
A relatively small number of tests fail when the underlying c library is provided by musl. This was originally reported in bpo-46390 by Christian Heimes. Among other changes, these tests were marked for skipping in pythongh-31947/ef1327e3 as part of bpo-40280 (emscripten support), but the skips were conditioned on the *platform* being emscripten (or wasi, skips for which ere added in 9b50585). In pythongh-131071 Victor Stinner added a linked_to_musl function to enable skipping a test in test_math that fails under musl, like it does on a number of other platforms. This check can successfully detect that python is running under musl on Alpine, which was the original problem report in bpo-46390. This PR replaces Victor's solution with an enhancement to platform.libc_ver that does the check more cheaply, and also gets the version number. The latter is important because the math test being skipped is due to a bug in musl that has been fixed, but as of this checkin date has not yet been released. When it is, the test skip can be fixed to check for the minimum needed version. The enhanced version of linked_to_musl is also used to do the skips of the other tests that generically fail under musl, as opposed to emscripten or wasi only failures. This will allow these tests to be skipped automatically on Alpine. This PR does *not* enhance libc_ver to support emscripten and wasi, as I'm not familiar with those platforms; instead it returns a version triple of (0, 0, 0) for those platforms. This means the musl tests will be skipped regardless of musl version, so ideally someone will add support to libc_ver for these platforms.
plashchynski pushed a commit to plashchynski/cpython that referenced this pull request Mar 17, 2025
Skip test_math.test_fma_zero_result() if Python is linked to the musl C library.
bitdancer added a commit that referenced this pull request Mar 19, 2025
* Make musl test skips smarter (fixes Alpine errors) A relatively small number of tests fail when the underlying c library is provided by musl. This was originally reported in bpo-46390 by Christian Heimes. Among other changes, these tests were marked for skipping in gh-31947/ef1327e3 as part of bpo-40280 (emscripten support), but the skips were conditioned on the *platform* being emscripten (or wasi, skips for which ere added in 9b50585). In gh-131071 Victor Stinner added a linked_to_musl function to enable skipping a test in test_math that fails under musl, like it does on a number of other platforms. This check can successfully detect that python is running under musl on Alpine, which was the original problem report in bpo-46390. This PR replaces Victor's solution with an enhancement to platform.libc_ver that does the check more cheaply, and also gets the version number. The latter is important because the math test being skipped is due to a bug in musl that has been fixed, but as of this checkin date has not yet been released. When it is, the test skip can be fixed to check for the minimum needed version. The enhanced version of linked_to_musl is also used to do the skips of the other tests that generically fail under musl, as opposed to emscripten or wasi only failures. This will allow these tests to be skipped automatically on Alpine. This PR does *not* enhance libc_ver to support emscripten and wasi, as I'm not familiar with those platforms; instead it returns a version triple of (0, 0, 0) for those platforms. This means the musl tests will be skipped regardless of musl version, so ideally someone will add support to libc_ver for these platforms. * Platform tests and bug fixes. In adding tests for the new platform code I found a bug in the old code: if a valid version is passed for version and it is greater than the version found for an so *and* there is no glibc version, then the version from the argument was returned. The code changes here fix that. * Add support docs, including for some preexisting is_xxx's. * Add news item about libc_ver enhancement. * Prettify platform re expression using re.VERBOSE.
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@vstinner@skirpichev@furkanonder