On Mon, May 4, 2009 at 7:10 PM, Robert Bradshaw <[email protected]> wrote: >> Unfortunatelly, I have to agree, for different reasons... As an >> starter, the current code does not handle Py3K on Windows (because of >> the new wchar_t based API) > > This should be sufficient, right? > > http://hg.cython.org/cython-devel/rev/2e35d5caac86 >
No, unfortunately it is not enough... I didn't tell you the whole story... Py3K has a wchar_t-based API for all platforms. On Windows, the fix is easy, you just use wmain(). On POSIX, not so easy... you have to use char-based, traditional main(), and use mbrtowc() to convent all the argument one by one... IMHO, core CPython is doing it wrong here... See the nightmare in py3k/Modules/python.c ... IMHO, Python should provide a both char-based and wchar_t-based API's, and internally implement the char-based ones as wrappers, managing the conversion char->wchat_t and then call the wchar_t-based API's. If this is not done, any one trying to embed python have to start converting arguments (and managing the tmp mem blocks), and have to cope with the apparent brokenness of mbrtowc() on some platforms... I've already had to implement all that crap in mpi4py, see http://code.google.com/p/mpi4py/source/browse/trunk/src/python.c (borrow code from Py3_Main_GetArgs() if you like it). Fortunately, that file is not frequently required for end-users, but I'm not even sure if it works on the many Unix-like systems out-there (current supercomputer systems hardly have python3 available for end-users) I do not have the energy to go to Python-Dev to discuss all this... Do any of you have it :-)? Stefan? Greg? -- 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 _______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
