mirror of
https://github.com/python/cpython.git
synced 2025-07-23 11:15:24 +00:00
bpo-36763: Add PyConfig_SetWideStringList() (GH-14444)
(cherry picked from commit 36242fd871
)
Co-authored-by: Victor Stinner <vstinner@redhat.com>
This commit is contained in:
parent
466e18e8c2
commit
96f581cf9d
4 changed files with 29 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue