diff options
author | Eric Snow <ericsnowcurrently@gmail.com> | 2023-02-15 23:05:07 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-15 23:05:07 (GMT) |
commit | b365d88465d9228ce4e9e0be20b88e9e4056ad88 (patch) | |
tree | c2f746555097abede7a9461cc7ae0cc1022ca272 /Modules/_testinternalcapi.c | |
parent | b2fc5492789623d656953d458f3eeaac03c1ef56 (diff) | |
download | cpython-b365d88465d9228ce4e9e0be20b88e9e4056ad88.zip cpython-b365d88465d9228ce4e9e0be20b88e9e4056ad88.tar.gz cpython-b365d88465d9228ce4e9e0be20b88e9e4056ad88.tar.bz2 |
gh-101758: Add a Test For Single-Phase Init Modules in Multiple Interpreters (gh-101920)
The test verifies the behavior of single-phase init modules when loaded in multiple interpreters.
https://github.com/python/cpython/issues/101758
Diffstat (limited to 'Modules/_testinternalcapi.c')
-rw-r--r-- | Modules/_testinternalcapi.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/Modules/_testinternalcapi.c b/Modules/_testinternalcapi.c index ba57719..632fac2 100644 --- a/Modules/_testinternalcapi.c +++ b/Modules/_testinternalcapi.c @@ -671,6 +671,20 @@ get_interp_settings(PyObject *self, PyObject *args) } +static PyObject * +clear_extension(PyObject *self, PyObject *args) +{ + PyObject *name = NULL, *filename = NULL; + if (!PyArg_ParseTuple(args, "OO:clear_extension", &name, &filename)) { + return NULL; + } + if (_PyImport_ClearExtension(name, filename) < 0) { + return NULL; + } + Py_RETURN_NONE; +} + + static PyMethodDef module_functions[] = { {"get_configs", get_configs, METH_NOARGS}, {"get_recursion_depth", get_recursion_depth, METH_NOARGS}, @@ -692,6 +706,7 @@ static PyMethodDef module_functions[] = { _TESTINTERNALCAPI_COMPILER_CODEGEN_METHODDEF _TESTINTERNALCAPI_OPTIMIZE_CFG_METHODDEF {"get_interp_settings", get_interp_settings, METH_VARARGS, NULL}, + {"clear_extension", clear_extension, METH_VARARGS, NULL}, {NULL, NULL} /* sentinel */ }; |