https://github.com/python/cpython/commit/7fe1a18b77ea1aef186c95c54e061b667a975989
commit: 7fe1a18b77ea1aef186c95c54e061b667a975989
branch: main
author: Victor Stinner <[email protected]>
committer: vstinner <[email protected]>
date: 2025-11-27T12:32:00+01:00
summary:

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

Move the private function to the internal C API (pycore_ceval.h).

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

diff --git a/Include/cpython/object.h b/Include/cpython/object.h
index 130a105de42150..8693390aeda624 100644
--- a/Include/cpython/object.h
+++ b/Include/cpython/object.h
@@ -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
diff --git a/Include/internal/pycore_ceval.h b/Include/internal/pycore_ceval.h
index 2ae84be7b33966..fa2a67ff95734a 100644
--- a/Include/internal/pycore_ceval.h
+++ b/Include/internal/pycore_ceval.h
@@ -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)  {
 }
 
diff --git a/Parser/parser.c b/Parser/parser.c
index 53417fb2b72b10..648b3702d8ff71 100644
--- a/Parser/parser.c
+++ b/Parser/parser.c
@@ -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; }
diff --git a/Tools/peg_generator/pegen/c_generator.py 
b/Tools/peg_generator/pegen/c_generator.py
index ffa73a64f21cfe..a4e111972bdad5 100644
--- a/Tools/peg_generator/pegen/c_generator.py
+++ b/Tools/peg_generator/pegen/c_generator.py
@@ -31,6 +31,7 @@
 
 EXTENSION_PREFIX = """\
 #include "pegen.h"
+#include "pycore_ceval.h"
 
 #if defined(Py_DEBUG) && defined(Py_BUILD_CORE)
 #  define D(x) if (p->debug) { x; }

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to