diff options
author | Victor Stinner <vstinner@redhat.com> | 2019-03-25 22:19:57 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-25 22:19:57 (GMT) |
commit | 1075d1684ab84dc7c28d93cfb46e95e70d3b6d3b (patch) | |
tree | 7a0543a13a28f88318d16f8900111ea10198a4a3 /Modules | |
parent | 91759d98015e1d6d5e1367cff60592ab548e7806 (diff) | |
download | cpython-1075d1684ab84dc7c28d93cfb46e95e70d3b6d3b.zip cpython-1075d1684ab84dc7c28d93cfb46e95e70d3b6d3b.tar.gz cpython-1075d1684ab84dc7c28d93cfb46e95e70d3b6d3b.tar.bz2 |
bpo-36301: Add _Py_GetConfigsAsDict() function (GH-12540)
* Add _Py_GetConfigsAsDict() function to get all configurations as a
dict.
* dump_config() of _testembed.c now dumps preconfig as a separated
key: call _Py_GetConfigsAsDict().
* Make _PyMainInterpreterConfig_AsDict() private.
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_testcapimodule.c | 26 |
1 files changed, 3 insertions, 23 deletions
diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c index 350ef77..c82ba0c 100644 --- a/Modules/_testcapimodule.c +++ b/Modules/_testcapimodule.c @@ -4675,27 +4675,9 @@ decode_locale_ex(PyObject *self, PyObject *args) static PyObject * -get_global_config(PyObject *self, PyObject *Py_UNUSED(args)) +get_configs(PyObject *self, PyObject *Py_UNUSED(args)) { - return _Py_GetGlobalVariablesAsDict(); -} - - -static PyObject * -get_core_config(PyObject *self, PyObject *Py_UNUSED(args)) -{ - PyInterpreterState *interp = _PyInterpreterState_Get(); - const _PyCoreConfig *config = _PyInterpreterState_GetCoreConfig(interp); - return _PyCoreConfig_AsDict(config); -} - - -static PyObject * -get_main_config(PyObject *self, PyObject *Py_UNUSED(args)) -{ - PyInterpreterState *interp = _PyInterpreterState_Get(); - const _PyMainInterpreterConfig *config = _PyInterpreterState_GetMainConfig(interp); - return _PyMainInterpreterConfig_AsDict(config); + return _Py_GetConfigsAsDict(); } @@ -4942,9 +4924,7 @@ static PyMethodDef TestMethods[] = { {"bad_get", (PyCFunction)(void(*)(void))bad_get, METH_FASTCALL}, {"EncodeLocaleEx", encode_locale_ex, METH_VARARGS}, {"DecodeLocaleEx", decode_locale_ex, METH_VARARGS}, - {"get_global_config", get_global_config, METH_NOARGS}, - {"get_core_config", get_core_config, METH_NOARGS}, - {"get_main_config", get_main_config, METH_NOARGS}, + {"get_configs", get_configs, METH_NOARGS}, #ifdef Py_REF_DEBUG {"negative_refcount", negative_refcount, METH_NOARGS}, #endif |