Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix test for raspian, macOS x86_64 and wasi
  • Loading branch information
diegorusso committed Jan 26, 2026
commit c17984899902ec2ca750aacd122e50d652ada269
29 changes: 20 additions & 9 deletions Lib/test/test_frame_pointer_unwind.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,27 @@ def _frame_pointers_expected(machine):
)
if "no-omit-frame-pointer" in cflags:
return True
if machine in {"aarch64", "arm64"}:
return "-fomit-frame-pointer" not in cflags
if machine == "x86_64":
if "omit-frame-pointer" in cflags:
return False
# MSVC ignores /Oy and /Oy- on x64/ARM64.
if sys.platform == "win32" and machine == "arm64":
# Windows ARM64 guidelines recommend frame pointers (x29) for stack walking.
if sys.platform == "darwin":
# macOS x86_64/ARM64 always have frame pointer by default.
return True
if sys.platform == "win32" and machine == "x86_64":
# Windows x64 uses unwind metadata; frame pointers are not required.
return None
if sys.platform == "linux":
if machine in {"aarch64", "arm64"}:
# 32-bit Linux is not supported
if sys.maxsize < 2**32:
return None
return True
if machine == "x86_64":
return False
if sys.platform == "win32":
# MSVC ignores /Oy and /Oy- on x64/ARM64.
if machine == "arm64":
# Windows ARM64 guidelines recommend frame pointers (x29) for stack walking.
return True
elif machine == "x86_64":
# Windows x64 uses unwind metadata; frame pointers are not required.
return None
return None


Expand Down Expand Up @@ -139,6 +149,7 @@ def _manual_unwind_length(**env):
) from exc


@unittest.skipIf(support.is_wasi, "test not supported on WASI")
class FramePointerUnwindTests(unittest.TestCase):

def setUp(self):
Expand Down
15 changes: 13 additions & 2 deletions Modules/_testinternalcapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
// Include test definitions from _testinternalcapi/
#include "_testinternalcapi/parts.h"

#ifdef HAVE_DLFCN_H
#if defined(HAVE_DLADDR) && !defined(__wasi__)
# include <dlfcn.h>
#endif
#ifdef MS_WINDOWS
Expand Down Expand Up @@ -178,7 +178,18 @@ classify_address(uintptr_t addr, int jit_enabled, PyInterpreterState *interp)
#endif
return "other";
}
#elif defined(HAVE_DLFCN_H)
#elif defined(__wasi__)
static const char *
classify_address(uintptr_t addr, int jit_enabled, PyInterpreterState *interp)
{
#ifdef _Py_JIT
if (jit_enabled && _PyJIT_AddressInJitCode(interp, addr)) {
return "jit";
}
#endif
return "other";
}
#elif defined(HAVE_DLADDR) && !defined(__wasi__)
static const char *
classify_address(uintptr_t addr, int jit_enabled, PyInterpreterState *interp)
{
Expand Down
Loading