diff options
author | Eric Snow <ericsnowcurrently@gmail.com> | 2024-04-02 20:35:52 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-02 20:35:52 (GMT) |
commit | f341d6017dd4e80509b69b5a9e2625b71b70f205 (patch) | |
tree | fee03c2fb5ec944ca20b41e5a390c73f1d03a241 /Include/internal | |
parent | cae4cdd07ddfcd8bcc05d683bac53815391c9907 (diff) | |
download | cpython-f341d6017dd4e80509b69b5a9e2625b71b70f205.zip cpython-f341d6017dd4e80509b69b5a9e2625b71b70f205.tar.gz cpython-f341d6017dd4e80509b69b5a9e2625b71b70f205.tar.bz2 |
gh-76785: Add PyInterpreterConfig Helpers (gh-117170)
These helpers make it easier to customize and inspect the config used to initialize interpreters. This is especially valuable in our tests. I found inspiration from the PyConfig API for the PyInterpreterConfig dict conversion stuff. As part of this PR I've also added a bunch of tests.
Diffstat (limited to 'Include/internal')
-rw-r--r-- | Include/internal/pycore_pylifecycle.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/Include/internal/pycore_pylifecycle.h b/Include/internal/pycore_pylifecycle.h index c675098..47ff080 100644 --- a/Include/internal/pycore_pylifecycle.h +++ b/Include/internal/pycore_pylifecycle.h @@ -116,6 +116,22 @@ PyAPI_FUNC(char*) _Py_SetLocaleFromEnv(int category); // Export for special main.c string compiling with source tracebacks int _PyRun_SimpleStringFlagsWithName(const char *command, const char* name, PyCompilerFlags *flags); + +/* interpreter config */ + +// Export for _testinternalcapi shared extension +PyAPI_FUNC(int) _PyInterpreterConfig_InitFromState( + PyInterpreterConfig *, + PyInterpreterState *); +PyAPI_FUNC(PyObject *) _PyInterpreterConfig_AsDict(PyInterpreterConfig *); +PyAPI_FUNC(int) _PyInterpreterConfig_InitFromDict( + PyInterpreterConfig *, + PyObject *); +PyAPI_FUNC(int) _PyInterpreterConfig_UpdateFromDict( + PyInterpreterConfig *, + PyObject *); + + #ifdef __cplusplus } #endif |