Skip to content

Commit 6198d88

Browse files
committed
Address Pablo's feedback
1 parent 815f1d2 commit 6198d88

File tree

2 files changed

+7
-13
lines changed

2 files changed

+7
-13
lines changed

Lib/test/test_frame_pointer_unwind.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ def test_manual_unwind_respects_frame_pointers(self):
205205
f"unexpected JIT frames counted on {self.machine} with env {env}",
206206
)
207207
else:
208-
self.assertEqual(
208+
self.assertLessEqual(
209209
python_frames,
210210
1,
211211
f"unexpected Python frames counted on {self.machine} with env {env}",

Modules/_testinternalcapi.c

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@
5757
#define MODULE_NAME "_testinternalcapi"
5858

5959

60+
static const uintptr_t min_frame_pointer_addr = 0x1000;
61+
62+
6063
static PyObject *
6164
_get_current_module(void)
6265
{
@@ -170,6 +173,8 @@ classify_address(uintptr_t addr, int jit_enabled, PyInterpreterState *interp)
170173
}
171174
return "other";
172175
}
176+
/* Module resolved but path unavailable: treat as non-JIT. */
177+
return "other";
173178
}
174179
#ifdef _Py_JIT
175180
if (jit_enabled && _PyJIT_AddressInJitCode(interp, addr)) {
@@ -178,17 +183,6 @@ classify_address(uintptr_t addr, int jit_enabled, PyInterpreterState *interp)
178183
#endif
179184
return "other";
180185
}
181-
#elif defined(__wasi__)
182-
static const char *
183-
classify_address(uintptr_t addr, int jit_enabled, PyInterpreterState *interp)
184-
{
185-
#ifdef _Py_JIT
186-
if (jit_enabled && _PyJIT_AddressInJitCode(interp, addr)) {
187-
return "jit";
188-
}
189-
#endif
190-
return "other";
191-
}
192186
#elif defined(HAVE_DLADDR) && !defined(__wasi__)
193187
static const char *
194188
classify_address(uintptr_t addr, int jit_enabled, PyInterpreterState *interp)
@@ -368,7 +362,7 @@ manual_unwind_from_fp(uintptr_t *frame_pointer)
368362

369363
uintptr_t *next_fp = (uintptr_t *)frame_pointer[0];
370364
// Stop if the frame pointer is extremely low.
371-
if ((uintptr_t)next_fp < 0x1000) {
365+
if ((uintptr_t)next_fp < min_frame_pointer_addr) {
372366
break;
373367
}
374368
uintptr_t next_addr = (uintptr_t)next_fp;

0 commit comments

Comments
 (0)