Commit 7a9e41e1 authored by scoder's avatar scoder Committed by GitHub

Merge pull request #2374 from gabrieldemarmiesse/test_pure_10

Adding tests for "pure python mode" part 10
parents 68742d85 3d951d79
import cython
@cython.exceptval(-1)
def func(x: cython.int) -> cython.int:
if x < 0:
raise ValueError("need integer >= 0")
return x + 1
......@@ -161,13 +161,9 @@ Static typing
.. literalinclude:: ../../examples/tutorial/pure/annotations.py
This can be combined with the ``@cython.exceptval()`` decorator for non-Python
return types::
return types:
@cython.exceptval(-1):
def func(x : cython.int) -> cython.int:
if x < 0:
raise ValueError("need integer >= 0")
return x+1
.. literalinclude:: ../../examples/tutorial/pure/exceptval.py
Since version 0.27, Cython also supports the variable annotations defined
in `PEP 526 <https://www.python.org/dev/peps/pep-0526/>`_. This allows to
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment