Skip to content

Conversation

@vstinner
Copy link
Member

@vstinner vstinner commented Jun 28, 2019

@vstinner
Copy link
Member Author

@zooba, @methane, @Yhg1s: What do you think of adding PyConfig_SetWideStringList to https://www.python.org/dev/peps/pep-0587/ ? IMHO this function is missing to make the API "complete". Even if technically, PyWideStringList_Append() should be enough for most usage :-)

While I wrote PR #14445 to cleanup old code of the implementation of the PEP 587, I failed to convert test_init_from_config() in Programs/_testembed.c to dynamically allocated memory. PyConfig API doesn't provide any function to set a wide string list, whereas the test sets warnoptions and xoptions.

While PyWideStringList_Append() could be used, I prefer to be able to provide a list created in pure C without PyConfig API "at once".

First, I wrote:

PyStatus PyConfig_SetWideStringList(PyConfig *config, PyWideStringList *list, const PyWideStringList *list2)

But there is no way to build a wide string list: I didn't add any API for that on purpose, to minimize the size of the API. There is no function to create an empty PyWideStringList, no function to clear a list, no function to copy a list, etc.

Maybe tomorrow we may want to add such functions, but it can be done later. I prefer to start with a smaller API.

@vstinner
Copy link
Member Author

vstinner commented Jul 1, 2019

While PyWideStringList_Append() could be used, I prefer to be able to provide a list created in pure C without PyConfig API "at once".

PyConfig_SetWideStringList() is different because first it clears the list, so options set previously are ignored. And I would like this behavior: replace existing list with my own list :-)

@vstinner vstinner merged commit 36242fd into python:master Jul 1, 2019
@vstinner vstinner deleted the config_set_wide_string_list branch July 1, 2019 17:13
@miss-islington
Copy link
Contributor

Thanks @vstinner for the PR 🌮🎉.. I'm working now to backport this PR to: 3.8.
🐍🍒⛏🤖

@bedevere-bot
Copy link

GH-14523 is a backport of this pull request to the 3.8 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jul 1, 2019
(cherry picked from commit 36242fd)

Co-authored-by: Victor Stinner <[email protected]>
@vstinner
Copy link
Member Author

vstinner commented Jul 1, 2019

Hum, I decided to merge this PR soon to try to get PR #14445 fix into Python 3.8 beta2, to have more time to test it before 3.8.0 final. We still have time to revisit the PyConfig_SetWideStringList API before 3.8.0 final if sometimes dislikes it :-)

miss-islington added a commit that referenced this pull request Jul 1, 2019
(cherry picked from commit 36242fd)

Co-authored-by: Victor Stinner <[email protected]>
lisroach pushed a commit to lisroach/cpython that referenced this pull request Sep 10, 2019
DinoV pushed a commit to DinoV/cpython that referenced this pull request Jan 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants