• da-woods's avatar
    Handle `for x in cpp_function_call()` (GH-3667) · 9cb557c3
    da-woods authored
    Fixes https://github.com/cython/cython/issues/3663
    
    This ensures that rvalues here are saved as temps, while keeping the
    existing behaviour for `for x in deref(vec)`, where the pointer for vec
    is copied, meaning it doesn't crash if vec is reassigned.
    
    The bit of this change liable to have the biggest effect is that I've
    changed the result type of dereference(x) and x[0] (where x is a c++
    type) to a reference rather than value type. I think this is OK because
    it matches what C++ does. If that isn't a sensible change then I can
    probably inspect the loop sequence more closely to try to detect this.
    9cb557c3
cpp_iterators.pyx 3.89 KB