summaryrefslogtreecommitdiffstats
path: root/Python/ceval.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/ceval.c')
-rw-r--r--Python/ceval.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/Python/ceval.c b/Python/ceval.c
index 1a120bb..04f2dde 100644
--- a/Python/ceval.c
+++ b/Python/ceval.c
@@ -6852,13 +6852,19 @@ PyEval_SetTrace(Py_tracefunc func, PyObject *arg)
}
-void
-_PyEval_SetCoroutineOriginTrackingDepth(PyThreadState *tstate, int new_depth)
+int
+_PyEval_SetCoroutineOriginTrackingDepth(int depth)
{
- assert(new_depth >= 0);
- tstate->coroutine_origin_tracking_depth = new_depth;
+ PyThreadState *tstate = _PyThreadState_GET();
+ if (depth < 0) {
+ _PyErr_SetString(tstate, PyExc_ValueError, "depth must be >= 0");
+ return -1;
+ }
+ tstate->coroutine_origin_tracking_depth = depth;
+ return 0;
}
+
int
_PyEval_GetCoroutineOriginTrackingDepth(void)
{