[3.12] gh-102251: Explicitly free state for test modules with state in test_import (GH-105085) by miss-islington · Pull Request #105170 · python/cpython
PyDoc_STRVAR(basic__clear_module_state_doc, "_clear_module_state()\n\ \n\ Free the module state and set it to uninitialized.");
static PyObject * basic__clear_module_state(PyObject *self, PyObject *Py_UNUSED(ignored)) { module_state *state = get_module_state(self); if (state != NULL) { clear_state(state); } Py_RETURN_NONE; }
#define _CLEAR_MODULE_STATE_METHODDEF \ {"_clear_module_state", basic__clear_module_state, METH_NOARGS, \ basic__clear_module_state_doc}
/*********************************************/ /* the _testsinglephase module (and aliases) */ /*********************************************/
/* This ia less typical of legacy extensions in the wild: /* This is less typical of legacy extensions in the wild: - single-phase init (same as _testsinglephase above) - has some module state - supports repeated initialization