Skip to content

Commit 0453ac2

Browse files
committed
Move stack pointer assertions to PyUnstable_ThreadState_ResetStack()
1 parent e823658 commit 0453ac2

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

Python/ceval.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -463,13 +463,6 @@ tstate_set_stack(PyThreadState *tstate,
463463
// Sanity checks
464464
assert(ts->c_stack_hard_limit <= ts->c_stack_soft_limit);
465465
assert(ts->c_stack_soft_limit < ts->c_stack_top);
466-
467-
// Test the stack pointer
468-
#if !defined(NDEBUG) && !defined(__wasi__)
469-
uintptr_t here_addr = _Py_get_machine_stack_pointer();
470-
assert(ts->c_stack_soft_limit < here_addr);
471-
assert(here_addr < ts->c_stack_top);
472-
#endif
473466
}
474467

475468

@@ -556,6 +549,13 @@ PyUnstable_ThreadState_ResetStack(PyThreadState *tstate)
556549
tstate_set_stack(tstate, (void*)start, size);
557550
ts->c_stack_init_start = start;
558551
ts->c_stack_init_size = size;
552+
553+
// Test the stack pointer
554+
#if !defined(NDEBUG) && !defined(__wasi__)
555+
uintptr_t here_addr = _Py_get_machine_stack_pointer();
556+
assert(ts->c_stack_soft_limit < here_addr);
557+
assert(here_addr < ts->c_stack_top);
558+
#endif
559559
}
560560

561561

0 commit comments

Comments
 (0)