#define PYTESTCAPI_NEED_INTERNAL_API
#include "parts.h"
#include "clinic/watchers.c.h"
#define Py_BUILD_CORE
#include "pycore_function.h"
#include "pycore_code.h"
#include "pycore_context.h"
static PyObject *g_dict_watch_events = …;
static int g_dict_watchers_installed = …;
static int
dict_watch_callback(PyDict_WatchEvent event,
PyObject *dict,
PyObject *key,
PyObject *new_value)
{ … }
static int
dict_watch_callback_second(PyDict_WatchEvent event,
PyObject *dict,
PyObject *key,
PyObject *new_value)
{ … }
static int
dict_watch_callback_error(PyDict_WatchEvent event,
PyObject *dict,
PyObject *key,
PyObject *new_value)
{ … }
static PyObject *
add_dict_watcher(PyObject *self, PyObject *kind)
{ … }
static PyObject *
clear_dict_watcher(PyObject *self, PyObject *watcher_id)
{ … }
static PyObject *
_testcapi_watch_dict_impl(PyObject *module, int watcher_id, PyObject *dict)
{ … }
static PyObject *
_testcapi_unwatch_dict_impl(PyObject *module, int watcher_id, PyObject *dict)
{ … }
static PyObject *
get_dict_watcher_events(PyObject *self, PyObject *Py_UNUSED(args))
{ … }
static PyObject *g_type_modified_events;
static int g_type_watchers_installed;
static int
type_modified_callback(PyTypeObject *type)
{ … }
static int
type_modified_callback_wrap(PyTypeObject *type)
{ … }
static int
type_modified_callback_error(PyTypeObject *type)
{ … }
static PyObject *
add_type_watcher(PyObject *self, PyObject *kind)
{ … }
static PyObject *
clear_type_watcher(PyObject *self, PyObject *watcher_id)
{ … }
static PyObject *
get_type_modified_events(PyObject *self, PyObject *Py_UNUSED(args))
{ … }
static PyObject *
_testcapi_watch_type_impl(PyObject *module, int watcher_id, PyObject *type)
{ … }
static PyObject *
_testcapi_unwatch_type_impl(PyObject *module, int watcher_id, PyObject *type)
{ … }
#define NUM_CODE_WATCHERS …
static int code_watcher_ids[NUM_CODE_WATCHERS] = …;
static int num_code_object_created_events[NUM_CODE_WATCHERS] = …;
static int num_code_object_destroyed_events[NUM_CODE_WATCHERS] = …;
static int
handle_code_object_event(int which_watcher, PyCodeEvent event, PyCodeObject *co) { … }
static int
first_code_object_callback(PyCodeEvent event, PyCodeObject *co)
{ … }
static int
second_code_object_callback(PyCodeEvent event, PyCodeObject *co)
{ … }
static int
noop_code_event_handler(PyCodeEvent event, PyCodeObject *co)
{ … }
static int
error_code_event_handler(PyCodeEvent event, PyCodeObject *co)
{ … }
static PyObject *
add_code_watcher(PyObject *self, PyObject *which_watcher)
{ … }
static PyObject *
clear_code_watcher(PyObject *self, PyObject *watcher_id)
{ … }
static PyObject *
get_code_watcher_num_created_events(PyObject *self, PyObject *watcher_id)
{ … }
static PyObject *
get_code_watcher_num_destroyed_events(PyObject *self, PyObject *watcher_id)
{ … }
static PyObject *
allocate_too_many_code_watchers(PyObject *self, PyObject *args)
{ … }
#define NUM_TEST_FUNC_WATCHERS …
static PyObject *pyfunc_watchers[NUM_TEST_FUNC_WATCHERS];
static int func_watcher_ids[NUM_TEST_FUNC_WATCHERS] = …;
static PyObject *
get_id(PyObject *obj)
{ … }
static int
call_pyfunc_watcher(PyObject *watcher, PyFunction_WatchEvent event,
PyFunctionObject *func, PyObject *new_value)
{ … }
static int
first_func_watcher_callback(PyFunction_WatchEvent event, PyFunctionObject *func,
PyObject *new_value)
{ … }
static int
second_func_watcher_callback(PyFunction_WatchEvent event,
PyFunctionObject *func, PyObject *new_value)
{ … }
static PyFunction_WatchCallback func_watcher_callbacks[NUM_TEST_FUNC_WATCHERS] = …;
static int
add_func_event(PyObject *module, const char *name, PyFunction_WatchEvent event)
{ … }
static PyObject *
add_func_watcher(PyObject *self, PyObject *func)
{ … }
static PyObject *
clear_func_watcher(PyObject *self, PyObject *watcher_id_obj)
{ … }
static int
noop_func_event_handler(PyFunction_WatchEvent event, PyFunctionObject *func,
PyObject *new_value)
{ … }
static PyObject *
allocate_too_many_func_watchers(PyObject *self, PyObject *args)
{ … }
#define NUM_CONTEXT_WATCHERS …
static int context_watcher_ids[NUM_CONTEXT_WATCHERS] = …;
static PyObject *context_switches[NUM_CONTEXT_WATCHERS];
static int
handle_context_watcher_event(int which_watcher, PyContextEvent event, PyObject *ctx) { … }
static int
first_context_watcher_callback(PyContextEvent event, PyObject *ctx) { … }
static int
second_context_watcher_callback(PyContextEvent event, PyObject *ctx) { … }
static int
noop_context_event_handler(PyContextEvent event, PyObject *ctx) { … }
static int
error_context_event_handler(PyContextEvent event, PyObject *ctx) { … }
static PyObject *
add_context_watcher(PyObject *self, PyObject *which_watcher)
{ … }
static PyObject *
clear_context_watcher(PyObject *self, PyObject *watcher_id)
{ … }
static PyObject *
clear_context_stack(PyObject *Py_UNUSED(self), PyObject *Py_UNUSED(args))
{ … }
static PyObject *
get_context_switches(PyObject *Py_UNUSED(self), PyObject *watcher_id)
{ … }
static PyObject *
allocate_too_many_context_watchers(PyObject *self, PyObject *args)
{ … }
static PyObject *
_testcapi_set_func_defaults_via_capi_impl(PyObject *module, PyObject *func,
PyObject *defaults)
{ … }
static PyObject *
_testcapi_set_func_kwdefaults_via_capi_impl(PyObject *module, PyObject *func,
PyObject *defaults)
{ … }
static PyMethodDef test_methods[] = …;
int
_PyTestCapi_Init_Watchers(PyObject *mod)
{ … }