Visitar URL original
3.13.16: test_math fails to import on musl (linked_to_musl() returns bool, compared to tuple) · Issue #159015 · python/cpython · GitHub
Skip to content

3.13.16: test_math fails to import on musl (linked_to_musl() returns bool, compared to tuple) #159015

Description

@agners

Bug report

Bug description:

The 3.13 backport of gh-152563 (#155753, commit 8e85d73) changed the skip condition of FMATests.test_fma_zero_result in Lib/test/test_math.py to:

or (support.linked_to_musl() and support.linked_to_musl() < (1, 2, 6)),  # gh-131032

On main/3.14, support.linked_to_musl() returns the musl version as a tuple. On the 3.13 branch it still returns a plain bool (return ('musl' in stdout)), so on a musl-based system the condition evaluates True < (1, 2, 6) and raises:

TypeError: '<' not supported between instances of 'bool' and 'tuple'

Because this happens inside the @unittest.skipIf(...) decorator, it is raised at class definition time and test_math fails to import entirely. test_cmath imports from test.test_math, so it fails too. On glibc the expression short-circuits on False, so it doesn't show up there.

This is a regression in 3.13.16. A visible consequence: building 3.13.16 on Alpine Linux with --enable-optimizations fails, because both modules are part of the PGO training set:

[ 8/43] test_cmath failed (uncaught exception)
[27/43] test_math failed (uncaught exception)
Total test files: run=43/43 failed=2
Result: FAILURE
make: *** [Makefile:911: profile-run-stamp] Error 2

To fix it, either restore the previous or support.linked_to_musl(), condition on 3.13, or also backport the linked_to_musl() change that returns a version tuple.

Seen in Home Assistant's Alpine-based Python images: home-assistant/docker-base#402

CPython versions tested on:

3.13

Operating systems tested on:

Linux

Linked PRs

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.13only security fixesOS-unsupportedpendingThe issue will be closed if no feedback is providedtestsTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or error

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions