gh-130396: Remove _Py_ReachedRecursionLimitWithMargin() function (#141951)

Move the private function to the internal C API (pycore_ceval.h).
This commit is contained in:
Victor Stinner 2025-11-27 12:32:00 +01:00 committed by GitHub
parent bc9e63dd9d
commit 7fe1a18b77
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 6 additions and 2 deletions

View file

@ -436,8 +436,6 @@ PyAPI_FUNC(void) _Py_NO_RETURN _PyObject_AssertFailed(
PyAPI_FUNC(void) _PyTrash_thread_deposit_object(PyThreadState *tstate, PyObject *op); PyAPI_FUNC(void) _PyTrash_thread_deposit_object(PyThreadState *tstate, PyObject *op);
PyAPI_FUNC(void) _PyTrash_thread_destroy_chain(PyThreadState *tstate); PyAPI_FUNC(void) _PyTrash_thread_destroy_chain(PyThreadState *tstate);
PyAPI_FUNC(int) _Py_ReachedRecursionLimitWithMargin(PyThreadState *tstate, int margin_count);
/* For backwards compatibility with the old trashcan mechanism */ /* For backwards compatibility with the old trashcan mechanism */
#define Py_TRASHCAN_BEGIN(op, dealloc) #define Py_TRASHCAN_BEGIN(op, dealloc)
#define Py_TRASHCAN_END #define Py_TRASHCAN_END

View file

@ -263,6 +263,10 @@ static inline int _Py_ReachedRecursionLimit(PyThreadState *tstate) {
#endif #endif
} }
extern int _Py_ReachedRecursionLimitWithMargin(
PyThreadState *tstate,
int margin_count);
static inline void _Py_LeaveRecursiveCall(void) { static inline void _Py_LeaveRecursiveCall(void) {
} }

1
Parser/parser.c generated
View file

@ -1,5 +1,6 @@
// @generated by pegen from python.gram // @generated by pegen from python.gram
#include "pegen.h" #include "pegen.h"
#include "pycore_ceval.h"
#if defined(Py_DEBUG) && defined(Py_BUILD_CORE) #if defined(Py_DEBUG) && defined(Py_BUILD_CORE)
# define D(x) if (p->debug) { x; } # define D(x) if (p->debug) { x; }

View file

@ -31,6 +31,7 @@
EXTENSION_PREFIX = """\ EXTENSION_PREFIX = """\
#include "pegen.h" #include "pegen.h"
#include "pycore_ceval.h"
#if defined(Py_DEBUG) && defined(Py_BUILD_CORE) #if defined(Py_DEBUG) && defined(Py_BUILD_CORE)
# define D(x) if (p->debug) { x; } # define D(x) if (p->debug) { x; }