[Cython] C++ STL iteration bugs

Robert Bradshaw robertwb at gmail.com
Mon Aug 13 17:42:47 CEST 2012


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.

- Robert


More information about the cython-devel mailing list