blob: 3e1480513f6c2ab9a100229ab8af861f769b52a8 [file] [log] [blame]
Nathaniel J. Smithfc2f4072018-01-21 06:44:07 -08001/*[clinic input]
2preserve
3[clinic start generated code]*/
4
5PyDoc_STRVAR(sys_set_coroutine_origin_tracking_depth__doc__,
6"set_coroutine_origin_tracking_depth($module, /, depth)\n"
7"--\n"
8"\n"
9"Enable or disable origin tracking for coroutine objects in this thread.\n"
10"\n"
11"Coroutine objects will track \'depth\' frames of traceback information about\n"
12"where they came from, available in their cr_origin attribute. Set depth of 0\n"
13"to disable.");
14
15#define SYS_SET_COROUTINE_ORIGIN_TRACKING_DEPTH_METHODDEF \
16 {"set_coroutine_origin_tracking_depth", (PyCFunction)sys_set_coroutine_origin_tracking_depth, METH_FASTCALL|METH_KEYWORDS, sys_set_coroutine_origin_tracking_depth__doc__},
17
18static PyObject *
19sys_set_coroutine_origin_tracking_depth_impl(PyObject *module, int depth);
20
21static PyObject *
22sys_set_coroutine_origin_tracking_depth(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObject *kwnames)
23{
24 PyObject *return_value = NULL;
25 static const char * const _keywords[] = {"depth", NULL};
26 static _PyArg_Parser _parser = {"i:set_coroutine_origin_tracking_depth", _keywords, 0};
27 int depth;
28
29 if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
30 &depth)) {
31 goto exit;
32 }
33 return_value = sys_set_coroutine_origin_tracking_depth_impl(module, depth);
34
35exit:
36 return return_value;
37}
38
39PyDoc_STRVAR(sys_get_coroutine_origin_tracking_depth__doc__,
40"get_coroutine_origin_tracking_depth($module, /)\n"
41"--\n"
42"\n"
43"Check status of origin tracking for coroutine objects in this thread.");
44
45#define SYS_GET_COROUTINE_ORIGIN_TRACKING_DEPTH_METHODDEF \
46 {"get_coroutine_origin_tracking_depth", (PyCFunction)sys_get_coroutine_origin_tracking_depth, METH_NOARGS, sys_get_coroutine_origin_tracking_depth__doc__},
47
48static int
49sys_get_coroutine_origin_tracking_depth_impl(PyObject *module);
50
51static PyObject *
52sys_get_coroutine_origin_tracking_depth(PyObject *module, PyObject *Py_UNUSED(ignored))
53{
54 PyObject *return_value = NULL;
55 int _return_value;
56
57 _return_value = sys_get_coroutine_origin_tracking_depth_impl(module);
58 if ((_return_value == -1) && PyErr_Occurred()) {
59 goto exit;
60 }
61 return_value = PyLong_FromLong((long)_return_value);
62
63exit:
64 return return_value;
65}
66/*[clinic end generated code: output=4a3ac42b97d710ff input=a9049054013a1b77]*/