serge-sans-paille / pythran

Ahead of Time compiler for numeric kernels
https://pythran.readthedocs.io
BSD 3-Clause "New" or "Revised" License
2k stars 193 forks source link

fails to compile #1101

Open nbecker opened 5 years ago

nbecker commented 5 years ago

Problem is: E: Incompatible types from different branches for @ret: Tuple[int, T0, T1] and Array[1d, int] (ldpc.py, line 118)

https://gist.github.com/nbecker/077b8d7494d1364de515e62c8d98c10a

serge-sans-paille commented 5 years ago
        return f_out, interleave, counts, locs
    else:
        return f_out

two different types, that's not compatible with pythran :-)

jeanlaroche commented 5 years ago

I find that this type of issue is not easy to identify. Even if you think you're returning the same types, you may not, in a way that's not always visible to the naked eye...

nbecker commented 5 years ago

Could pythran provide a better error message for such cases?

Maybe also add something about this to the user manual.

serge-sans-paille commented 5 years ago

It's a tremendous task , maybe try with mypy ? Numpy support does not seem satisfying though... https://github.com/numpy/numpy-stubs