summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@redhat.com>2018-11-13 23:24:28 (GMT)
committerGitHub <noreply@github.com>2018-11-13 23:24:28 (GMT)
commit7ddd56f4d835c6107b20a0b4233185bb59270142 (patch)
treefaffdfb7ca138f1b40c608b3b2727cfe34f1f5f3 /Modules
parent746b2d35ea47005054ed774fecaed64fab803d7d (diff)
downloadcpython-7ddd56f4d835c6107b20a0b4233185bb59270142.zip
cpython-7ddd56f4d835c6107b20a0b4233185bb59270142.tar.gz
cpython-7ddd56f4d835c6107b20a0b4233185bb59270142.tar.bz2
bpo-35233: Rewrite test_embed.InitConfigTests (GH-10524)
* Fix _PyCoreConfig_SetGlobalConfig(): set also Py_FrozenFlag * Fix _PyCoreConfig_AsDict(): export also xoptions * Add _Py_GetGlobalVariablesAsDict() and _testcapi.get_global_config() * test.pythoninfo: dump also global configuration variables * _testembed now serializes global, core and main configurations using JSON to reuse _Py_GetGlobalVariablesAsDict(), _PyCoreConfig_AsDict() and _PyMainInterpreterConfig_AsDict(), rather than duplicating code. * test_embed.InitConfigTests now test much more configuration variables
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_testcapimodule.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c
index 205b668..56a08a4 100644
--- a/Modules/_testcapimodule.c
+++ b/Modules/_testcapimodule.c
@@ -4694,7 +4694,14 @@ decode_locale_ex(PyObject *self, PyObject *args)
static PyObject *
-get_coreconfig(PyObject *self, PyObject *Py_UNUSED(args))
+get_global_config(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 = &interp->core_config;
@@ -4703,7 +4710,7 @@ get_coreconfig(PyObject *self, PyObject *Py_UNUSED(args))
static PyObject *
-get_mainconfig(PyObject *self, PyObject *Py_UNUSED(args))
+get_main_config(PyObject *self, PyObject *Py_UNUSED(args))
{
PyInterpreterState *interp = _PyInterpreterState_Get();
const _PyMainInterpreterConfig *config = &interp->config;
@@ -4956,8 +4963,9 @@ static PyMethodDef TestMethods[] = {
{"bad_get", bad_get, METH_FASTCALL},
{"EncodeLocaleEx", encode_locale_ex, METH_VARARGS},
{"DecodeLocaleEx", decode_locale_ex, METH_VARARGS},
- {"get_coreconfig", get_coreconfig, METH_NOARGS},
- {"get_mainconfig", get_mainconfig, METH_NOARGS},
+ {"get_global_config", get_global_config, METH_NOARGS},
+ {"get_core_config", get_core_config, METH_NOARGS},
+ {"get_main_config", get_main_config, METH_NOARGS},
#ifdef Py_REF_DEBUG
{"negative_refcount", negative_refcount, METH_NOARGS},
#endif