Suggested PySys_SetArgv use with a (char **) argv ?

Sorry... ---------- Forwarded message ---------- From: Lisandro Dalcin <dalcinl@gmail.com> Date: Tue, Jul 7, 2009 at 7:16 PM Subject: Re: [Python-Dev] Suggested PySys_SetArgv use with a (char **) argv ? To: "Martin v. Löwis" <martin@v.loewis.de> On Tue, Jul 7, 2009 at 6:46 PM, "Martin v. Löwis"<martin@v.loewis.de> wrote:
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've run in the same issue, and basically had to copy&paste from Python sources...
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.
Indeed...
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.
What about the Python lib exposing a public PyOS_char2wchar() ? No idea how to write a Windows implementation, though.. -- Lisandro Dalcín --------------- Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC) Instituto de Desarrollo Tecnológico para la Industria Química (INTEC) Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET) PTLC - Güemes 3450, (3000) Santa Fe, Argentina Tel/Fax: +54-(0)342-451.1594 -- Lisandro Dalcín --------------- Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC) Instituto de Desarrollo Tecnológico para la Industria Química (INTEC) Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET) PTLC - Güemes 3450, (3000) Santa Fe, Argentina Tel/Fax: +54-(0)342-451.1594

The reason I was a big vague is that I'm not really bothered HOW its done, I'd just like there to be some way to use PySys_SetArgv with a (char **) Definitely not suggesting that PySys_SetArgv be reverted to the way it worked in py2.x, if there was 2 versions of PySys_SetArgv that would be acceptable to me. PySys_SetArgvASCII() maybe? Alternately a function to convert the char **argv to wchar_t **argv could be ok too. PyOS_char2wchar would be useful though it still means you need to manually copy the argv, convert and free it. On Tue, Jul 7, 2009 at 3:18 PM, Lisandro Dalcin<dalcinl@gmail.com> wrote:
Sorry...
---------- Forwarded message ---------- From: Lisandro Dalcin <dalcinl@gmail.com> Date: Tue, Jul 7, 2009 at 7:16 PM Subject: Re: [Python-Dev] Suggested PySys_SetArgv use with a (char **) argv ? To: "Martin v. Löwis" <martin@v.loewis.de>
On Tue, Jul 7, 2009 at 6:46 PM, "Martin v. Löwis"<martin@v.loewis.de> wrote:
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've run in the same issue, and basically had to copy&paste from Python sources...
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.
Indeed...
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.
What about the Python lib exposing a public PyOS_char2wchar() ?
No idea how to write a Windows implementation, though..
-- Lisandro Dalcín --------------- Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC) Instituto de Desarrollo Tecnológico para la Industria Química (INTEC) Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET) PTLC - Güemes 3450, (3000) Santa Fe, Argentina Tel/Fax: +54-(0)342-451.1594
-- Lisandro Dalcín --------------- Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC) Instituto de Desarrollo Tecnológico para la Industria Química (INTEC) Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET) PTLC - Güemes 3450, (3000) Santa Fe, Argentina Tel/Fax: +54-(0)342-451.1594
-- - Campbell

The reason I was a big vague is that I'm not really bothered HOW its done, I'd just like there to be some way to use PySys_SetArgv with a (char **)
Ok, that's easy: void PySys_SetArgvChar(int argc, char** argv) { PySys_SetArgv(0, NULL); } So you don't bother *how* it's done as long as you can pass char** in some way.
Alternately a function to convert the char **argv to wchar_t **argv could be ok too.
Convert in what manner? What is the encoding of your char**? Regards, Martin
participants (3)
-
"Martin v. Löwis"
-
Campbell Barton
-
Lisandro Dalcin