https://github.com/python/cpython/commit/1b0c05f14807a43d070127b3d8eac1af8de27f28 commit: 1b0c05f14807a43d070127b3d8eac1af8de27f28 branch: main author: Ivy Xu <[email protected]> committer: vstinner <[email protected]> date: 2026-06-29T16:47:21+02:00 summary:
gh-151040: Fix `test_c_stack_unwind` on RISC-V (#152370) files: M Modules/_testinternalcapi.c diff --git a/Modules/_testinternalcapi.c b/Modules/_testinternalcapi.c index 6506bd53b0377a..f6ff7820821ce1 100644 --- a/Modules/_testinternalcapi.c +++ b/Modules/_testinternalcapi.c @@ -98,6 +98,11 @@ static const uintptr_t min_frame_pointer_addr = 0x1000; // https://refspecs.linuxfoundation.org/ELF/ppc64/PPC-elf64abi-1.9.html#STACK # define FRAME_POINTER_NEXT_OFFSET 0 # define FRAME_POINTER_RETURN_OFFSET 2 +#elif defined(__riscv) +// RISC-V saves the return address at fp[-1], and the previous frame pointer at fp[-2]. +// See: https://riscv-non-isa.github.io/riscv-elf-psabi-doc/#_frame_pointer_convention +# define FRAME_POINTER_NEXT_OFFSET -2 +# define FRAME_POINTER_RETURN_OFFSET -1 #elif defined(__loongarch__) // On LoongArch, the frame pointer is the caller's stack pointer. // The saved frame pointer is stored at fp[-2], and the return _______________________________________________ Python-checkins mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3//lists/python-checkins.python.org Member address: [email protected]
