diff options
author | Victor Stinner <vstinner@python.org> | 2020-05-01 11:33:44 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-05-01 11:33:44 +0200 |
commit | 252346acd937ddba4845331994b8ff4f90349625 (patch) | |
tree | 71d6298db81733d652abaa510c09ba90078efff0 /Python/initconfig.c | |
parent | 8bcfd31cc01e068bca78aa42a87c24aea6ebc6b1 (diff) | |
download | cpython-git-252346acd937ddba4845331994b8ff4f90349625.tar.gz |
bpo-40453: Add PyConfig._isolated_subinterpreter (GH-19820)
An isolated subinterpreter cannot spawn threads, spawn a child
process or call os.fork().
* Add private _Py_NewInterpreter(isolated_subinterpreter) function.
* Add isolated=True keyword-only parameter to
_xxsubinterpreters.create().
* Allow again os.fork() in "non-isolated" subinterpreters.
Diffstat (limited to 'Python/initconfig.c')
-rw-r--r-- | Python/initconfig.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Python/initconfig.c b/Python/initconfig.c index 58cca562f3..185935c05f 100644 --- a/Python/initconfig.c +++ b/Python/initconfig.c @@ -632,6 +632,7 @@ _PyConfig_InitCompatConfig(PyConfig *config) config->check_hash_pycs_mode = NULL; config->pathconfig_warnings = -1; config->_init_main = 1; + config->_isolated_interpreter = 0; #ifdef MS_WINDOWS config->legacy_windows_stdio = -1; #endif @@ -850,6 +851,7 @@ _PyConfig_Copy(PyConfig *config, const PyConfig *config2) COPY_WSTR_ATTR(check_hash_pycs_mode); COPY_ATTR(pathconfig_warnings); COPY_ATTR(_init_main); + COPY_ATTR(_isolated_interpreter); #undef COPY_ATTR #undef COPY_WSTR_ATTR @@ -949,6 +951,7 @@ config_as_dict(const PyConfig *config) SET_ITEM_WSTR(check_hash_pycs_mode); SET_ITEM_INT(pathconfig_warnings); SET_ITEM_INT(_init_main); + SET_ITEM_INT(_isolated_interpreter); return dict; |