Skip to content

Commit 34d9153

Browse files
committed
Rename to PyUnstable_ThreadState_SetStackProtection()
1 parent 2f7b92e commit 34d9153

File tree

8 files changed

+20
-20
lines changed

8 files changed

+20
-20
lines changed

Doc/c-api/exceptions.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -940,7 +940,7 @@ because the :ref:`call protocol <call>` takes care of recursion handling.
940940
depth limit.
941941
942942
.. seealso::
943-
The :c:func:`PyUnstable_ThreadState_SetStack` function.
943+
The :c:func:`PyUnstable_ThreadState_SetStackProtection` function.
944944
945945
.. versionchanged:: 3.9
946946
This function is now also available in the :ref:`limited API <limited-c-api>`.

Doc/c-api/init.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1353,7 +1353,7 @@ All of the following functions must be called after :c:func:`Py_Initialize`.
13531353
.. versionadded:: 3.11
13541354
13551355
1356-
.. c:function:: int PyUnstable_ThreadState_SetStack(PyThreadState *tstate, void *stack_start_addr, size_t stack_size)
1356+
.. c:function:: int PyUnstable_ThreadState_SetStackProtection(PyThreadState *tstate, void *stack_start_addr, size_t stack_size)
13571357
13581358
Set the stack start address and stack size of a Python thread state.
13591359
@@ -1367,24 +1367,24 @@ All of the following functions must be called after :c:func:`Py_Initialize`.
13671367
normally gets from the operating system.
13681368
When the stack is changed, for example using context switching techniques like the
13691369
Boost library's ``boost::context``, you must call
1370-
:c:func:`~PyUnstable_ThreadState_SetStack` to inform CPython of the change.
1370+
:c:func:`~PyUnstable_ThreadState_SetStackProtection` to inform CPython of the change.
13711371
1372-
Call :c:func:`~PyUnstable_ThreadState_SetStack` either before
1372+
Call :c:func:`~PyUnstable_ThreadState_SetStackProtection` either before
13731373
or after changing the stack.
13741374
Do not call any other Python C API between the call and the stack
13751375
change.
13761376
1377-
See :c:func:`PyUnstable_ThreadState_ResetStack` for undoing this operation.
1377+
See :c:func:`PyUnstable_ThreadState_ResetStackProtection` for undoing this operation.
13781378
13791379
.. versionadded:: next
13801380
13811381
1382-
.. c:function:: void PyUnstable_ThreadState_ResetStack(PyThreadState *tstate)
1382+
.. c:function:: void PyUnstable_ThreadState_ResetStackProtection(PyThreadState *tstate)
13831383
13841384
Reset the stack start address and stack size of a Python thread state to
13851385
the operating system defaults.
13861386
1387-
See :c:func:`PyUnstable_ThreadState_SetStack` for an explanation.
1387+
See :c:func:`PyUnstable_ThreadState_SetStackProtection` for an explanation.
13881388
13891389
.. versionadded:: next
13901390

Doc/whatsnew/3.14.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2994,8 +2994,8 @@ New features in the C API
29942994
as arguments to C API functions.
29952995
(Contributed by Sam Gross in :gh:`133164`.)
29962996

2997-
* Add :c:func:`PyUnstable_ThreadState_SetStack` and
2998-
:c:func:`PyUnstable_ThreadState_ResetStack` functions to set the stack base
2997+
* Add :c:func:`PyUnstable_ThreadState_SetStackProtection` and
2998+
:c:func:`PyUnstable_ThreadState_ResetStackProtection` functions to set the stack base
29992999
address and stack size of a Python thread state.
30003000
(Contributed by Victor Stinner in :gh:`139653`.)
30013001

Include/cpython/pystate.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,13 +253,13 @@ PyAPI_FUNC(int) PyGILState_Check(void);
253253
PyAPI_FUNC(PyObject*) _PyThread_CurrentFrames(void);
254254

255255
// Set the stack start address and stack size of a Python thread state
256-
PyAPI_FUNC(int) PyUnstable_ThreadState_SetStack(
256+
PyAPI_FUNC(int) PyUnstable_ThreadState_SetStackProtection(
257257
PyThreadState *tstate,
258258
void *stack_start_addr, // Stack start address
259259
size_t stack_size); // Stack size (in bytes)
260260

261261
// Reset the stack start address and stack size of a Python thread state
262-
PyAPI_FUNC(void) PyUnstable_ThreadState_ResetStack(
262+
PyAPI_FUNC(void) PyUnstable_ThreadState_ResetStackProtection(
263263
PyThreadState *tstate);
264264

265265
/* Routines for advanced debuggers, requested by David Beazley.

Include/internal/pycore_tstate.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ typedef struct _PyThreadStateImpl {
3737
uintptr_t c_stack_soft_limit;
3838
uintptr_t c_stack_hard_limit;
3939

40-
// PyUnstable_ThreadState_ResetStack() values
40+
// PyUnstable_ThreadState_ResetStackProtection() values
4141
uintptr_t c_stack_init_base;
4242
uintptr_t c_stack_init_top;
4343

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
Add :c:func:`PyUnstable_ThreadState_SetStack` and
2-
:c:func:`PyUnstable_ThreadState_ResetStack` functions to set the stack base
1+
Add :c:func:`PyUnstable_ThreadState_SetStackProtection` and
2+
:c:func:`PyUnstable_ThreadState_ResetStackProtection` functions to set the stack base
33
address and stack size of a Python thread state. Patch by Victor Stinner.

Modules/_testinternalcapi.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2421,7 +2421,7 @@ set_vectorcall_nop(PyObject *self, PyObject *func)
24212421
static void
24222422
check_threadstate_set_stack(PyThreadState *tstate, void *start, size_t size)
24232423
{
2424-
assert(PyUnstable_ThreadState_SetStack(tstate, start, size) == 0);
2424+
assert(PyUnstable_ThreadState_SetStackProtection(tstate, start, size) == 0);
24252425
assert(!PyErr_Occurred());
24262426

24272427
_PyThreadStateImpl *ts = (_PyThreadStateImpl *)tstate;
@@ -2455,12 +2455,12 @@ test_threadstate_set_stack(PyObject *self, PyObject *Py_UNUSED(args))
24552455
// Test invalid size (too small)
24562456
size = 5;
24572457
start = (void*)(_Py_get_machine_stack_pointer() - size);
2458-
assert(PyUnstable_ThreadState_SetStack(tstate, start, size) == -1);
2458+
assert(PyUnstable_ThreadState_SetStackProtection(tstate, start, size) == -1);
24592459
assert(PyErr_ExceptionMatches(PyExc_ValueError));
24602460
PyErr_Clear();
24612461

2462-
// Test PyUnstable_ThreadState_ResetStack()
2463-
PyUnstable_ThreadState_ResetStack(tstate);
2462+
// Test PyUnstable_ThreadState_ResetStackProtection()
2463+
PyUnstable_ThreadState_ResetStackProtection(tstate);
24642464
assert(ts->c_stack_init_base == init_base);
24652465
assert(ts->c_stack_init_top == init_top);
24662466

Python/ceval.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,7 @@ _Py_InitializeRecursionLimits(PyThreadState *tstate)
530530

531531

532532
int
533-
PyUnstable_ThreadState_SetStack(PyThreadState *tstate,
533+
PyUnstable_ThreadState_SetStackProtection(PyThreadState *tstate,
534534
void *stack_start_addr, size_t stack_size)
535535
{
536536
if (stack_size < _PyOS_MIN_STACK_SIZE) {
@@ -548,7 +548,7 @@ PyUnstable_ThreadState_SetStack(PyThreadState *tstate,
548548

549549

550550
void
551-
PyUnstable_ThreadState_ResetStack(PyThreadState *tstate)
551+
PyUnstable_ThreadState_ResetStackProtection(PyThreadState *tstate)
552552
{
553553
_PyThreadStateImpl *ts = (_PyThreadStateImpl *)tstate;
554554
if (ts->c_stack_init_top != 0) {

0 commit comments

Comments
 (0)