GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-131032: Add support.linked_to_musl() function by vstinner · Pull Request #131071 · python/cpython

Conversation

@vstinner

@vstinner vstinner commented Mar 11, 2025 •
edited by bedevere-app Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

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

  • Issue: test_math.test_fma_zero_result() fails with the musl C library #131032

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@vstinner
pythongh-131032: Add support.linked_to_musl() function
e2b890c
Skip test_math.test_fma_zero_result() if Python is linked to the musl
C library.
@vstinner vstinner added skip news needs backport to 3.12 only security fixes needs backport to 3.13 only security fixes labels Mar 11, 2025
@bedevere-app bedevere-app Bot added the awaiting core review label Mar 11, 2025
@bedevere-app bedevere-app Bot mentioned this pull request Mar 11, 2025
test_math.test_fma_zero_result() fails with the musl C library #131032
Closed
@vstinner

vstinner commented Mar 11, 2025

Copy link
Copy Markdown
Member Author

cc @mdickinson @skirpichev

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@skirpichev

skirpichev commented Mar 11, 2025

Copy link
Copy Markdown
Member

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vstinner

vstinner commented Mar 11, 2025

Copy link
Copy Markdown
Member Author

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

furkanonder
furkanonder approved these changes Mar 11, 2025
View reviewed changes

@furkanonder furkanonder left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

LGTM

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@vstinner

vstinner commented Mar 11, 2025

Copy link
Copy Markdown
Member Author

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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vstinner

vstinner commented Mar 11, 2025

Copy link
Copy Markdown
Member Author

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

skirpichev
skirpichev approved these changes Mar 11, 2025
View reviewed changes

@skirpichev skirpichev left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this 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).

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@vstinner

vstinner commented Mar 12, 2025

Copy link
Copy Markdown
Member Author

I proposed a different fix for test_math: #131134

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@skirpichev skirpichev mentioned this pull request Mar 13, 2025
gh-131032: Fix math.fma(x, y, z) zero sign #131134
Closed
@vstinner
vstinner merged commit 68922ac into python:main Mar 13, 2025
@miss-islington-app

miss-islington-app Bot commented Mar 13, 2025

Copy link
Copy Markdown

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot removed the awaiting core review label Mar 13, 2025
@vstinner
vstinner deleted the linked_to_musl branch March 13, 2025 09:33
@miss-islington-app

miss-islington-app Bot commented Mar 13, 2025

Copy link
Copy Markdown

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
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@miss-islington-app miss-islington-app Bot assigned vstinner Mar 13, 2025
@miss-islington-app

miss-islington-app Bot commented Mar 13, 2025

Copy link
Copy Markdown

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
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app

bedevere-app Bot commented Mar 13, 2025

Copy link
Copy Markdown

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot removed the needs backport to 3.13 only security fixes label Mar 13, 2025
vstinner added a commit to vstinner/cpython that referenced this pull request Mar 13, 2025
@vstinner
pythongh-131032: Add support.linked_to_musl() function (python#131071)
1d884fa
Skip test_math.test_fma_zero_result() if Python is linked to the musl
C library.

(cherry picked from commit 68922ac)
@vstinner vstinner removed the needs backport to 3.12 only security fixes label Mar 13, 2025
@vstinner

vstinner commented Mar 13, 2025

Copy link
Copy Markdown
Member Author

@vstinner vstinner removed the needs backport to 3.12 label

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

vstinner added a commit that referenced this pull request Mar 13, 2025
@vstinner
[3.13] gh-131032: Add support.linked_to_musl() function (#131071) (#1…
050813c
…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
@bitdancer
Make musl test skips smarter (fixes Alpine errors)
2348711
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.
@bitdancer bitdancer mentioned this pull request Mar 15, 2025
gh-90548: Make musl test skips smarter (fixes Alpine errors) #131313
Merged
plashchynski pushed a commit to plashchynski/cpython that referenced this pull request Mar 17, 2025
@vstinner @plashchynski
pythongh-131032: Add support.linked_to_musl() function (python#131071)
a1683c0
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
@bitdancer
gh-90548: Make musl test skips smarter (fixes Alpine errors) (#131313)
6146295
* 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 free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@skirpichev skirpichev skirpichev approved these changes
@furkanonder furkanonder furkanonder approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@vstinner vstinner

Labels

skip news

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@vstinner @skirpichev @furkanonder
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.