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 — test_c_stack_unwind fails on Linux LoongArch builds · Issue #152240 · python/cpython

test_c_stack_unwind fails on Linux LoongArch builds #152240

New issue
Copy link
New issue
Copy link
Closed
Closed
test_c_stack_unwind fails on Linux LoongArch builds#152240
Copy link
Labels
OS-unsupportedtestsTests in the Lib/test dirTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Description

@yzewei
yzewei
opened on Jun 26, 2026
Issue body actions

Bug report

Bug description:

On the Linux LoongArch64 platform, the test_c_stack_unwind test fails because CPython's manually implemented frame-pointer unwinding mechanism fails to recognize the LoongArch stack frame layout (as it relies on the default FRAME_POINTER_NEXT_OFFSET and FRAME_POINTER_RETURN_OFFSET). This issue affects builds using both GCC and Clang.

In the LoongArch architecture, the frame pointer points to the caller's stack pointer; the previous frame pointer is stored at fp[-2], and the return address is stored at fp[-1].

Additionally, for CPython builds compiled with Clang, unexpected failures occur in test sections involving the GNU backtrace() function. By default, Clang/LoongArch generates .debug_frame sections but does not generate the .eh_frame unwinding tables required for runtime unwinding of CPython's C objects. Consequently, glibc's backtrace() returns only a single stack frame and cannot unwind through Python stack frames.

Reproducer

GCC build:

../cpython/configure --with-pydebug CC=gcc
make -j8
PYTHON_JIT=0 ./python -m test -v test_c_stack_unwind

clang build:

../cpython/configure --with-pydebug CC=clang
make -j8
PYTHON_JIT=0 ./python -m test -v test_c_stack_unwind

Environment

  • CPython main
  • Linux LoongArch64
  • GCC version: 15.3.0
  • Clang 20.1.8
  • glibc 2.42

CPython versions tested on:

CPython main branch

Operating systems tested on:

Linux

Linked PRs

  • gh-152240: Fix test_c_stack_unwind on Linux LoongArch builds #152241
  • [3.15] gh-152240: Fix test_c_stack_unwind on Linux LoongArch builds (GH-152241) #152578

Activity

  1. yzewei
    added
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    on Jun 26, 2026
  2. StanFromIreland
    added
    OS-unsupported
    on Jun 26, 2026
  3. github-project-automation
    added this to Unsupported platformson Jun 26, 2026
  4. StanFromIreland
    added
    testsTests in the Lib/test dirTests in the Lib/test dir
    on Jun 26, 2026
  5. StanFromIreland commented on Jun 26, 2026

    @StanFromIreland
    StanFromIreland
    on Jun 26, 2026
    Member
    More actions

    Related issues:

    • python/cpython#151040 for riscv64 (I think LoongArch is a RISC arch.?)
    • python/cpython#151602 for i586
    Reacted by Ivy Xu
  6. yzewei commented on Jun 29, 2026

    @yzewei
    yzewei
    on Jun 29, 2026
    ContributorAuthor
    More actions

    Related issues:

    • python/cpython#151040 for riscv64 (I think LoongArch is a RISC arch.?)
    • python/cpython#151602 for i586

    That's true; similar operations need to be performed for loongarch. Correct the offsets for obtaining sp and ra. #152241

  7. yzewei
    added 2 commits that reference this issue on Jun 29, 2026

    pythongh-152240: Fix LoongArch frame pointer unwinding

    809c42d

    pythongh-152240: Fix LoongArch frame pointer unwinding

    50bb458
  8. vstinner
    added a commit that references this issue on Jun 29, 2026

    gh-152240: Fix test_c_stack_unwind on Linux LoongArch builds (#152241)

    8458582
  9. yzewei
    added a commit that references this issue on Jun 29, 2026

    pythongh-152240: Fix LoongArch frame pointer unwinding

    fd250d8
  10. encukou
    closed this as completedon Oct 13, 2026
  11. github-project-automation
    moved this to Done in Unsupported platformson Oct 13, 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

    OS-unsupportedtestsTests in the Lib/test dirTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

    Projects

    • Unsupported platforms
      Status
      Done
      Show more project fields

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    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.