(root)/
Python-3.12.0/
Modules/
_testcapi/
clinic/
watchers.c.h
       1  /*[clinic input]
       2  preserve
       3  [clinic start generated code]*/
       4  
       5  #if defined(Py_BUILD_CORE) && !defined(Py_BUILD_CORE_MODULE)
       6  #  include "pycore_gc.h"            // PyGC_Head
       7  #  include "pycore_runtime.h"       // _Py_ID()
       8  #endif
       9  
      10  
      11  PyDoc_STRVAR(_testcapi_watch_dict__doc__,
      12  "watch_dict($module, watcher_id, dict, /)\n"
      13  "--\n"
      14  "\n");
      15  
      16  #define _TESTCAPI_WATCH_DICT_METHODDEF    \
      17      {"watch_dict", _PyCFunction_CAST(_testcapi_watch_dict), METH_FASTCALL, _testcapi_watch_dict__doc__},
      18  
      19  static PyObject *
      20  _testcapi_watch_dict_impl(PyObject *module, int watcher_id, PyObject *dict);
      21  
      22  static PyObject *
      23  _testcapi_watch_dict(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
      24  {
      25      PyObject *return_value = NULL;
      26      int watcher_id;
      27      PyObject *dict;
      28  
      29      if (!_PyArg_CheckPositional("watch_dict", nargs, 2, 2)) {
      30          goto exit;
      31      }
      32      watcher_id = _PyLong_AsInt(args[0]);
      33      if (watcher_id == -1 && PyErr_Occurred()) {
      34          goto exit;
      35      }
      36      dict = args[1];
      37      return_value = _testcapi_watch_dict_impl(module, watcher_id, dict);
      38  
      39  exit:
      40      return return_value;
      41  }
      42  
      43  PyDoc_STRVAR(_testcapi_unwatch_dict__doc__,
      44  "unwatch_dict($module, watcher_id, dict, /)\n"
      45  "--\n"
      46  "\n");
      47  
      48  #define _TESTCAPI_UNWATCH_DICT_METHODDEF    \
      49      {"unwatch_dict", _PyCFunction_CAST(_testcapi_unwatch_dict), METH_FASTCALL, _testcapi_unwatch_dict__doc__},
      50  
      51  static PyObject *
      52  _testcapi_unwatch_dict_impl(PyObject *module, int watcher_id, PyObject *dict);
      53  
      54  static PyObject *
      55  _testcapi_unwatch_dict(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
      56  {
      57      PyObject *return_value = NULL;
      58      int watcher_id;
      59      PyObject *dict;
      60  
      61      if (!_PyArg_CheckPositional("unwatch_dict", nargs, 2, 2)) {
      62          goto exit;
      63      }
      64      watcher_id = _PyLong_AsInt(args[0]);
      65      if (watcher_id == -1 && PyErr_Occurred()) {
      66          goto exit;
      67      }
      68      dict = args[1];
      69      return_value = _testcapi_unwatch_dict_impl(module, watcher_id, dict);
      70  
      71  exit:
      72      return return_value;
      73  }
      74  
      75  PyDoc_STRVAR(_testcapi_watch_type__doc__,
      76  "watch_type($module, watcher_id, type, /)\n"
      77  "--\n"
      78  "\n");
      79  
      80  #define _TESTCAPI_WATCH_TYPE_METHODDEF    \
      81      {"watch_type", _PyCFunction_CAST(_testcapi_watch_type), METH_FASTCALL, _testcapi_watch_type__doc__},
      82  
      83  static PyObject *
      84  _testcapi_watch_type_impl(PyObject *module, int watcher_id, PyObject *type);
      85  
      86  static PyObject *
      87  _testcapi_watch_type(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
      88  {
      89      PyObject *return_value = NULL;
      90      int watcher_id;
      91      PyObject *type;
      92  
      93      if (!_PyArg_CheckPositional("watch_type", nargs, 2, 2)) {
      94          goto exit;
      95      }
      96      watcher_id = _PyLong_AsInt(args[0]);
      97      if (watcher_id == -1 && PyErr_Occurred()) {
      98          goto exit;
      99      }
     100      type = args[1];
     101      return_value = _testcapi_watch_type_impl(module, watcher_id, type);
     102  
     103  exit:
     104      return return_value;
     105  }
     106  
     107  PyDoc_STRVAR(_testcapi_unwatch_type__doc__,
     108  "unwatch_type($module, watcher_id, type, /)\n"
     109  "--\n"
     110  "\n");
     111  
     112  #define _TESTCAPI_UNWATCH_TYPE_METHODDEF    \
     113      {"unwatch_type", _PyCFunction_CAST(_testcapi_unwatch_type), METH_FASTCALL, _testcapi_unwatch_type__doc__},
     114  
     115  static PyObject *
     116  _testcapi_unwatch_type_impl(PyObject *module, int watcher_id, PyObject *type);
     117  
     118  static PyObject *
     119  _testcapi_unwatch_type(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
     120  {
     121      PyObject *return_value = NULL;
     122      int watcher_id;
     123      PyObject *type;
     124  
     125      if (!_PyArg_CheckPositional("unwatch_type", nargs, 2, 2)) {
     126          goto exit;
     127      }
     128      watcher_id = _PyLong_AsInt(args[0]);
     129      if (watcher_id == -1 && PyErr_Occurred()) {
     130          goto exit;
     131      }
     132      type = args[1];
     133      return_value = _testcapi_unwatch_type_impl(module, watcher_id, type);
     134  
     135  exit:
     136      return return_value;
     137  }
     138  
     139  PyDoc_STRVAR(_testcapi_set_func_defaults_via_capi__doc__,
     140  "set_func_defaults_via_capi($module, func, defaults, /)\n"
     141  "--\n"
     142  "\n");
     143  
     144  #define _TESTCAPI_SET_FUNC_DEFAULTS_VIA_CAPI_METHODDEF    \
     145      {"set_func_defaults_via_capi", _PyCFunction_CAST(_testcapi_set_func_defaults_via_capi), METH_FASTCALL, _testcapi_set_func_defaults_via_capi__doc__},
     146  
     147  static PyObject *
     148  _testcapi_set_func_defaults_via_capi_impl(PyObject *module, PyObject *func,
     149                                            PyObject *defaults);
     150  
     151  static PyObject *
     152  _testcapi_set_func_defaults_via_capi(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
     153  {
     154      PyObject *return_value = NULL;
     155      PyObject *func;
     156      PyObject *defaults;
     157  
     158      if (!_PyArg_CheckPositional("set_func_defaults_via_capi", nargs, 2, 2)) {
     159          goto exit;
     160      }
     161      func = args[0];
     162      defaults = args[1];
     163      return_value = _testcapi_set_func_defaults_via_capi_impl(module, func, defaults);
     164  
     165  exit:
     166      return return_value;
     167  }
     168  
     169  PyDoc_STRVAR(_testcapi_set_func_kwdefaults_via_capi__doc__,
     170  "set_func_kwdefaults_via_capi($module, func, defaults, /)\n"
     171  "--\n"
     172  "\n");
     173  
     174  #define _TESTCAPI_SET_FUNC_KWDEFAULTS_VIA_CAPI_METHODDEF    \
     175      {"set_func_kwdefaults_via_capi", _PyCFunction_CAST(_testcapi_set_func_kwdefaults_via_capi), METH_FASTCALL, _testcapi_set_func_kwdefaults_via_capi__doc__},
     176  
     177  static PyObject *
     178  _testcapi_set_func_kwdefaults_via_capi_impl(PyObject *module, PyObject *func,
     179                                              PyObject *defaults);
     180  
     181  static PyObject *
     182  _testcapi_set_func_kwdefaults_via_capi(PyObject *module, PyObject *const *args, Py_ssize_t nargs)
     183  {
     184      PyObject *return_value = NULL;
     185      PyObject *func;
     186      PyObject *defaults;
     187  
     188      if (!_PyArg_CheckPositional("set_func_kwdefaults_via_capi", nargs, 2, 2)) {
     189          goto exit;
     190      }
     191      func = args[0];
     192      defaults = args[1];
     193      return_value = _testcapi_set_func_kwdefaults_via_capi_impl(module, func, defaults);
     194  
     195  exit:
     196      return return_value;
     197  }
     198  /*[clinic end generated code: output=12c375089125d165 input=a9049054013a1b77]*/