Suggested PySys_SetArgv use with a (char **) argv ?
In Python3 PySys_SetArgv takes (wchar_t **) for the argv, I looked into converting a (char **) into a (wchar_t **) and while its possible its lengthy enough not to be trivial, see python.c:18 - char2wcharm(), its 102 lines with ifdef's and goto's, not including the loop lower down that loops over the argv. Looking further python has a very similar function for ./PC/bdist_wininst/install.c, for do_run_installscript - widen_string(). Since many C applications take argv as a (char **) it seems reasonable for python to keep a function for the C api that accepts a (char **) argument for argv. otherwise each C applications that embeds python will need to write their own conversion function. also noticed Demo/embed/demo.c is out of date, giving (char **) to PySys_SetArgv(). -- - Campbell
Since many C applications take argv as a (char **) it seems reasonable for python to keep a function for the C api that accepts a (char **) argument for argv.
I'm not quite sure what you are suggesting: either that there is a function in the C API that accepts a (char**), or that PySys_SetArgv be that function. The latter alternative is out of question, as it breaks the Windows port of Python - there is simply no way of representing argv with char** in a meaningful way. It also breaks backwards compatibility. As for creating another function: please provide a patch to bugs.python.org. I believe this patch is *very* difficult to implement, unless the function can accept some severe limitations. Regards, Martin
participants (2)
-
"Martin v. Löwis"
-
Campbell Barton