Skip to content

Commit 7761d31

Browse files
committed
Make ABI function needed for Py_TRASHCAN_BEGIN private
1 parent 21366c3 commit 7761d31

File tree

13 files changed

+462
-458
lines changed

13 files changed

+462
-458
lines changed

Doc/data/stable_abi.dat

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Include/ceval.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,6 @@ PyAPI_FUNC(int) Py_GetRecursionLimit(void);
6060
PyAPI_FUNC(int) Py_EnterRecursiveCall(const char *where);
6161
PyAPI_FUNC(void) Py_LeaveRecursiveCall(void);
6262

63-
PyAPI_FUNC(int) Py_ReachedRecursionLimit(PyThreadState *tstate, int margin_count);
64-
6563
PyAPI_FUNC(const char *) PyEval_GetFuncName(PyObject *);
6664
PyAPI_FUNC(const char *) PyEval_GetFuncDesc(PyObject *);
6765

Include/cpython/object.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -487,16 +487,19 @@ PyAPI_FUNC(void) _PyTrash_thread_destroy_chain(PyThreadState *tstate);
487487
* we have headroom above the trigger limit */
488488
#define Py_TRASHCAN_HEADROOM 50
489489

490+
/* Helper function for Py_TRASHCAN_BEGIN */
491+
PyAPI_FUNC(int) _Py_ReachedRecursionLimitWithMargin(PyThreadState *tstate, int margin_count);
492+
490493
#define Py_TRASHCAN_BEGIN(op, dealloc) \
491494
do { \
492495
PyThreadState *tstate = PyThreadState_Get(); \
493-
if (Py_ReachedRecursionLimit(tstate, 1) && Py_TYPE(op)->tp_dealloc == (destructor)dealloc) { \
496+
if (_Py_ReachedRecursionLimitWithMargin(tstate, 1) && Py_TYPE(op)->tp_dealloc == (destructor)dealloc) { \
494497
_PyTrash_thread_deposit_object(tstate, (PyObject *)op); \
495498
break; \
496499
}
497500
/* The body of the deallocator is here. */
498501
#define Py_TRASHCAN_END \
499-
if (tstate->delete_later && !Py_ReachedRecursionLimit(tstate, 2)) { \
502+
if (tstate->delete_later && !_Py_ReachedRecursionLimitWithMargin(tstate, 2)) { \
500503
_PyTrash_thread_destroy_chain(tstate); \
501504
} \
502505
} while (0);

Include/internal/pycore_ceval.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -224,16 +224,16 @@ static inline void _Py_LeaveRecursiveCallTstate(PyThreadState *tstate) {
224224

225225
PyAPI_FUNC(void) _Py_InitializeRecursionLimits(PyThreadState *tstate);
226226

227-
static inline int _Py_ReachedRecursionLimit(PyThreadState *tstate, int margin_count) {
227+
static inline int _Py_ReachedRecursionLimit(PyThreadState *tstate) {
228228
char here;
229229
uintptr_t here_addr = (uintptr_t)&here;
230-
if (here_addr > tstate->c_stack_soft_limit + margin_count * PYOS_STACK_MARGIN_BYTES) {
230+
if (here_addr > tstate->c_stack_soft_limit) {
231231
return 0;
232232
}
233233
if (tstate->c_stack_hard_limit == 0) {
234234
_Py_InitializeRecursionLimits(tstate);
235235
}
236-
return here_addr <= tstate->c_stack_soft_limit + margin_count * PYOS_STACK_MARGIN_BYTES;
236+
return here_addr <= tstate->c_stack_soft_limit;
237237
}
238238

239239
static inline void _Py_LeaveRecursiveCall(void) {

Lib/test/test_stable_abi_ctypes.py

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Misc/stable_abi.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2545,5 +2545,3 @@
25452545
added = '3.14'
25462546
[function.Py_PACK_VERSION]
25472547
added = '3.14'
2548-
[function.Py_ReachedRecursionLimit]
2549-
added = '3.14'

PC/python3dll.c

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)