summaryrefslogtreecommitdiffstats
path: root/Python/initconfig.c
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@redhat.com>2019-07-01 17:13:50 (GMT)
committerGitHub <noreply@github.com>2019-07-01 17:13:50 (GMT)
commit36242fd871d0f0977e720d4fae5700774bd8c09a (patch)
treeae4c503575eb19d889c46b7cf7368553f351380d /Python/initconfig.c
parente21b45a8e71d06a6a03f99261cab33e72b896bb9 (diff)
downloadcpython-36242fd871d0f0977e720d4fae5700774bd8c09a.zip
cpython-36242fd871d0f0977e720d4fae5700774bd8c09a.tar.gz
cpython-36242fd871d0f0977e720d4fae5700774bd8c09a.tar.bz2
bpo-36763: Add PyConfig_SetWideStringList() (GH-14444)
Diffstat (limited to 'Python/initconfig.c')
-rw-r--r--Python/initconfig.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/Python/initconfig.c b/Python/initconfig.c
index 786f694..c44ae6b 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)
@@ -2324,6 +2324,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