From f4b1e3d7c64985f5d5b00f6cc9a1c146bbbfd613 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Mon, 4 Nov 2019 19:48:34 +0100 Subject: 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. --- Python/ceval.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'Python') 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(); +} -- cgit v1.2.1