On Wed, Oct 28, 2009 at 1:30 PM, Dag Sverre Seljebotn <[email protected]> wrote: > Stefan Behnel wrote: >> Robert Bradshaw, 28.10.2009 10:45: >> >>> On Oct 28, 2009, at 12:21 AM, Stefan Behnel wrote: >>> >>>> Mark Lodato, 24.10.2009 17:49: >>>> >>>>> On Sat, Oct 24, 2009 at 1:47 AM, Stefan Behnel wrote: >>>>> >>>>>> There's also #434 about --embed not working in Py3. Mark, did you >>>>>> test your >>>>>> patch under Py3.1? >>>>>> >>>>> I saw that bug, and cython_freeze has the exact same problems as >>>>> --embed. I'm working on a fix now. >>>>> >>>> ... any news from this front? >>>> >>> Yes, see >>> >>> http://trac.cython.org/cython_trac/ticket/439 >>> >> >> Mark, thanks a lot for doing that. I hope you copied the wchar_t adaptation >> part from somewhere, looks like a lot of work otherwise. >> >> One thing that strikes me, however, is the amount of code duplication. I >> think we should put cython_freeze into the Cython package (e.g. as >> Cython/Compiler/MainFunction.py), so that the compiler can use it to >> generate a main() function, and just add a __main__ execution body at the >> end that runs from the command line. Distutils could still install the >> module as a "cython_freeze" script in /usr/bin then, and the shipped >> bin/cython_freeze would simply import and run >> Cython/Compiler/MainFunction.py (so that you don't need to install Cython >> to get a runnable script). >> >> Another thing I noticed is the use of PyMem_Malloc() and friends. I'm not >> sure if it's safe to use those before initialising the Python interpreter. >> Anyway, I think that plain malloc() and free() make more sense here. >> > They require the GIL, last time I looked, so should probably be avoided. >
No, I think you are wrong. PyMem_Malloc()/PyMem_Free() do not require the GIL (for non-debug builds, at least), as they are wrappers to system malloc() and free() (note: malloc(0) actually does malloc(1))... Anyway, I agree that for the freezing purpuses, it would be better to use system malloc()/free(), just take care of making matching calls, if not, problems could happen (remember about Windows, MSVC vs MinGW , incompatible CRT's) -- 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
