]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-130396: Remove _Py_ReachedRecursionLimitWithMargin() function (#141951)
authorVictor Stinner <vstinner@python.org>
Thu, 27 Nov 2025 11:32:00 +0000 (12:32 +0100)
committerGitHub <noreply@github.com>
Thu, 27 Nov 2025 11:32:00 +0000 (12:32 +0100)
Move the private function to the internal C API (pycore_ceval.h).

Include/cpython/object.h
Include/internal/pycore_ceval.h
Parser/parser.c
Tools/peg_generator/pegen/c_generator.py

index 130a105de42150a2be4dd1cb938055dc36a5f307..8693390aeda624e934beeca05b00861569194272 100644 (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_destroy_chain(PyThreadState *tstate);
 
-PyAPI_FUNC(int) _Py_ReachedRecursionLimitWithMargin(PyThreadState *tstate, int margin_count);
-
 /* For backwards compatibility with the old trashcan mechanism */
 #define Py_TRASHCAN_BEGIN(op, dealloc)
 #define Py_TRASHCAN_END
index 2ae84be7b33966d00f44d9faa25c6e155f61f9ff..fa2a67ff95734a750c83e55c18f2317c834c7d54 100644 (file)
@@ -263,6 +263,10 @@ static inline int _Py_ReachedRecursionLimit(PyThreadState *tstate)  {
 #endif
 }
 
+extern int _Py_ReachedRecursionLimitWithMargin(
+    PyThreadState *tstate,
+    int margin_count);
+
 static inline void _Py_LeaveRecursiveCall(void)  {
 }
 
index 53417fb2b72b1071806a84c047e230b1f75342d5..648b3702d8ff71b1b3d6a741b1d867a4ece13638 100644 (file)
@@ -1,5 +1,6 @@
 // @generated by pegen from python.gram
 #include "pegen.h"
+#include "pycore_ceval.h"
 
 #if defined(Py_DEBUG) && defined(Py_BUILD_CORE)
 #  define D(x) if (p->debug) { x; }
index ffa73a64f21cfe41fa496456b35ac9e5ef41d79f..a4e111972bdad5b3392aed477eda1fd3f00f539c 100644 (file)
@@ -31,6 +31,7 @@ from pegen.parser_generator import ParserGenerator
 
 EXTENSION_PREFIX = """\
 #include "pegen.h"
+#include "pycore_ceval.h"
 
 #if defined(Py_DEBUG) && defined(Py_BUILD_CORE)
 #  define D(x) if (p->debug) { x; }