[Cython] Issue with function annotations

Stefan Behnel stefan_ml at behnel.de
Wed Sep 27 10:18:58 EDT 2017

Lisandro Dalcin schrieb am 27.09.2017 um 15:53:
> Annotations can be used for
> type hinting, but they are not required to do that.

Well, they sort of are, according to PEP 484.

> For example, in my
> own use case, I'm just using it to get better docstrings.

Then you can set the directive "annotation_typing=False".

> In this commit:
> commit 806e2fe6eefea5bfa011a45ea556d93c2094a95a
> Author: Stefan Behnel <stefan_ml at behnel.de>
> Date:   Sat Sep 2 21:01:28 2017 +0200
>     Disable an "embedsignatures" test that is not actually valid with
> PEP 484 but fails to compile as the return type now interpreted as a
> C-tuple of Python objects (which is not supported).
> You disabled one of my test case. This test case is about docstrings,
> not type hints! I wrote that test on purpose, to prevent regressions.
> At the time I wrote the example, IIRC, annotation_typing=False was the
> default.  At most, we should add `#cython: annotation_typing=False` in
> the top, and Cython should happily accept the code and the test should
> succeed.
> I can try to contribute a fix. I would like to ignore C-tuples in
> annotations at least if annotation_typing=False. Any pointers about
> where to start looking?

No need, I just fixed it:



More information about the cython-devel mailing list