From 9087243e2c167e38570e819b228efc3492c38c9c Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Mon, 21 Mar 2022 02:24:00 +0100 Subject: bpo-46850: Remove _PyEval_GetCoroutineOriginTrackingDepth() (GH-32018) Remove the private undocumented function _PyEval_GetCoroutineOriginTrackingDepth() from the C API. Call the public sys.get_coroutine_origin_tracking_depth() function instead. Change the internal function _PyEval_SetCoroutineOriginTrackingDepth(): * Remove the 'tstate' parameter; * Add return value and raises an exception if depth is negative; * No longer export the function: call the public sys.set_coroutine_origin_tracking_depth() function instead. Uniformize also function declarations in pycore_ceval.h. --- Python/sysmodule.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'Python/sysmodule.c') diff --git a/Python/sysmodule.c b/Python/sysmodule.c index ae6d7c2955..c89f81f689 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -1186,12 +1186,9 @@ static PyObject * sys_set_coroutine_origin_tracking_depth_impl(PyObject *module, int depth) /*[clinic end generated code: output=0a2123c1cc6759c5 input=a1d0a05f89d2c426]*/ { - PyThreadState *tstate = _PyThreadState_GET(); - if (depth < 0) { - _PyErr_SetString(tstate, PyExc_ValueError, "depth must be >= 0"); + if (_PyEval_SetCoroutineOriginTrackingDepth(depth) < 0) { return NULL; } - _PyEval_SetCoroutineOriginTrackingDepth(tstate, depth); Py_RETURN_NONE; } -- cgit v1.2.1