diff options
author | Victor Stinner <vstinner@python.org> | 2023-07-04 09:41:43 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-04 09:41:43 (GMT) |
commit | c9ce983ae1a361f431a0303aeb6f4b8e1d674275 (patch) | |
tree | e5e6dae3885a270ffeea975ff03462c186af68c9 /Modules/_testcapimodule.c | |
parent | 8a73b57b9b5f6e36dd5a4c279f4d606d9e71a31f (diff) | |
download | cpython-c9ce983ae1a361f431a0303aeb6f4b8e1d674275.zip cpython-c9ce983ae1a361f431a0303aeb6f4b8e1d674275.tar.gz cpython-c9ce983ae1a361f431a0303aeb6f4b8e1d674275.tar.bz2 |
gh-106320: Remove private pylifecycle.h functions (#106400)
Remove private pylifecycle.h functions: move them to the internal C
API ( pycore_atexit.h, pycore_pylifecycle.h and pycore_signal.h). No
longer export most of these functions.
Move _testcapi.test_atexit() to _testinternalcapi.
Diffstat (limited to 'Modules/_testcapimodule.c')
-rw-r--r-- | Modules/_testcapimodule.c | 32 |
1 files changed, 0 insertions, 32 deletions
diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c index d1044b5..2baf453 100644 --- a/Modules/_testcapimodule.c +++ b/Modules/_testcapimodule.c @@ -3293,37 +3293,6 @@ function_set_kw_defaults(PyObject *self, PyObject *args) Py_RETURN_NONE; } -struct atexit_data { - int called; -}; - -static void -callback(void *data) -{ - ((struct atexit_data *)data)->called += 1; -} - -static PyObject * -test_atexit(PyObject *self, PyObject *Py_UNUSED(args)) -{ - PyThreadState *oldts = PyThreadState_Swap(NULL); - PyThreadState *tstate = Py_NewInterpreter(); - - struct atexit_data data = {0}; - int res = _Py_AtExit(tstate->interp, callback, (void *)&data); - Py_EndInterpreter(tstate); - PyThreadState_Swap(oldts); - if (res < 0) { - return NULL; - } - if (data.called == 0) { - PyErr_SetString(PyExc_RuntimeError, "atexit callback not called"); - return NULL; - } - Py_RETURN_NONE; -} - - static PyObject * check_pyimport_addmodule(PyObject *self, PyObject *args) { @@ -3613,7 +3582,6 @@ static PyMethodDef TestMethods[] = { {"function_set_defaults", function_set_defaults, METH_VARARGS, NULL}, {"function_get_kw_defaults", function_get_kw_defaults, METH_O, NULL}, {"function_set_kw_defaults", function_set_kw_defaults, METH_VARARGS, NULL}, - {"test_atexit", test_atexit, METH_NOARGS}, {"check_pyimport_addmodule", check_pyimport_addmodule, METH_VARARGS}, {"test_weakref_capi", test_weakref_capi, METH_NOARGS}, {NULL, NULL} /* sentinel */ |