diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2019-07-01 17:39:58 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-01 17:39:58 (GMT) |
commit | 96f581cf9d2f1d7888d2fd9bb89f19f10c0477bf (patch) | |
tree | c2286c3e8876b881e7fb91eb5ba4bfd95714d94e /Python | |
parent | 466e18e8c2738b06a24915cb186d954821d0414f (diff) | |
download | cpython-96f581cf9d2f1d7888d2fd9bb89f19f10c0477bf.zip cpython-96f581cf9d2f1d7888d2fd9bb89f19f10c0477bf.tar.gz cpython-96f581cf9d2f1d7888d2fd9bb89f19f10c0477bf.tar.bz2 |
bpo-36763: Add PyConfig_SetWideStringList() (GH-14444)
(cherry picked from commit 36242fd871d0f0977e720d4fae5700774bd8c09a)
Co-authored-by: Victor Stinner <vstinner@redhat.com>
Diffstat (limited to 'Python')
-rw-r--r-- | Python/initconfig.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/Python/initconfig.c b/Python/initconfig.c index e791a0d..1c7078a 100644 --- a/Python/initconfig.c +++ b/Python/initconfig.c @@ -732,7 +732,7 @@ _PyConfig_Copy(PyConfig *config, const PyConfig *config2) } while (0) #define COPY_WSTRLIST(LIST) \ do { \ - if (_PyWideStringList_Copy(&config->LIST, &config2->LIST) < 0 ) { \ + if (_PyWideStringList_Copy(&config->LIST, &config2->LIST) < 0) { \ return _PyStatus_NO_MEMORY(); \ } \ } while (0) @@ -2277,6 +2277,23 @@ PyConfig_SetArgv(PyConfig *config, Py_ssize_t argc, wchar_t * const *argv) } +PyStatus +PyConfig_SetWideStringList(PyConfig *config, PyWideStringList *list, + Py_ssize_t length, wchar_t **items) +{ + PyStatus status = _Py_PreInitializeFromConfig(config, NULL); + if (_PyStatus_EXCEPTION(status)) { + return status; + } + + PyWideStringList list2 = {.length = length, .items = items}; + if (_PyWideStringList_Copy(list, &list2) < 0) { + return _PyStatus_NO_MEMORY(); + } + return _PyStatus_OK(); +} + + /* Read the configuration into PyConfig from: * Command line arguments |