summaryrefslogtreecommitdiff
path: root/Python/ceval.c
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2019-11-04 19:48:34 +0100
committerGitHub <noreply@github.com>2019-11-04 19:48:34 +0100
commitf4b1e3d7c64985f5d5b00f6cc9a1c146bbbfd613 (patch)
treeb42e4aaf30370f71b5622f8a41976ac71706d8e8 /Python/ceval.c
parent6552563b3d5061816720a5a6c7d4ffd6ba35b98b (diff)
downloadcpython-git-f4b1e3d7c64985f5d5b00f6cc9a1c146bbbfd613.tar.gz
bpo-38644: Add Py_EnterRecursiveCall() to the limited API (GH-17046)
Provide Py_EnterRecursiveCall() and Py_LeaveRecursiveCall() as regular functions for the limited API. Previously, there were defined as macros, but these macros didn't work with the limited API which cannot access PyThreadState.recursion_depth field. Remove _Py_CheckRecursionLimit from the stable ABI. Add Include/cpython/ceval.h header file.
Diffstat (limited to 'Python/ceval.c')
-rw-r--r--Python/ceval.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index a7d2ea8006..881a7dd629 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -5632,3 +5632,21 @@ maybe_dtrace_line(PyFrameObject *frame,
}
*instr_prev = frame->f_lasti;
}
+
+
+/* Implement Py_EnterRecursiveCall() and Py_LeaveRecursiveCall() as functions
+ for the limited API. */
+
+#undef Py_EnterRecursiveCall
+
+int Py_EnterRecursiveCall(const char *where)
+{
+ return _Py_EnterRecursiveCall_macro(where);
+}
+
+#undef Py_LeaveRecursiveCall
+
+void Py_LeaveRecursiveCall(void)
+{
+ _Py_LeaveRecursiveCall_macro();
+}