[Cython] C++ STL iteration bugs

mark florisson markflorisson88 at gmail.com
Mon Aug 13 18:25:40 CEST 2012


On 13 August 2012 16:42, Robert Bradshaw <robertwb at gmail.com> wrote:
> On Sun, Aug 12, 2012 at 3:26 AM, mark florisson
> <markflorisson88 at gmail.com> wrote:
>> On 12 August 2012 08:00, Robert Bradshaw <robertwb at gmail.com> wrote:
>>> On Sat, Aug 11, 2012 at 1:19 PM, Stefan Behnel <stefan_ml at behnel.de> wrote:
>>>> Hi,
>>>>
>>>> I ran into a couple of problems with the new C++ STL integration, just
>>>> dumping them here for now.
>>>>
>>>> Invalid C code when using a stack allocated C++ vector inside of a
>>>> generator, also lacking type conversion utility code:
>>>>
>>>> https://github.com/cython/cython/commit/d0a8e24720c3ed4e723b5a1b204bf375780f51bd
>>>
>>> The problem here is that utility code attached at this stage of the
>>> pipeline gets ignored. In particular, we get to
>>> https://github.com/cython/cython/blob/a7c689c10eea66f9fe384d7bc324a7aa50975f9d/Cython/Compiler/UtilityCode.py#L130
>>> which I am at a loss to explain.
>>
>> Heh, that should have had a comment :) Cython utility codes are
>> inserted at the AST level in ModuleNode (the merge_in method). This is
>> done since there is no actual C code at that point. I think it could
>> generate it and capture it as well, but it's probably more
>> complicated, and this works well with the name mangling schemes and
>> such.
>
> I figured there was a good explanation :). For the moment, we could
> probably work around it by calling the relevant functions earlier in
> the pipeline, but it would be nice to get rid of this limitation.

Yeah, it may work to just pass in the code object or the right
insertion point to the code generation function of the AST. I
inherited the code and never really touched that part, no idea if that
will break things.

> - Robert
> _______________________________________________
> cython-devel mailing list
> cython-devel at python.org
> http://mail.python.org/mailman/listinfo/cython-devel


More information about the cython-devel mailing list