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

  1. agners commented on Oct 8, 2026

    @agners
    Author

    Fix for 3.13: #159016

  2. agners commented on Oct 8, 2026

    @agners
    Author

    @weixlu FYI, this is essentially a bad backport from what I can tell.

  3. added
    type-bugAn unexpected behavior, bug, or error
    testsTests in the Lib/test dir
    3.13only security fixes
    on Oct 8, 2026
  4. skirpichev commented on Oct 8, 2026

    @skirpichev
    Member

    v3.13 is for security fixes only. I doubt this fits...
    Edit: see #159016 (review)

  5. added
    pendingThe issue will be closed if no feedback is provided
    and removed
    pendingThe issue will be closed if no feedback is provided
    on Oct 8, 2026
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-unsupportedtestsTests 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