You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

66 lines
2.3 KiB

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