summaryrefslogtreecommitdiff
path: root/docs/examples/tutorial/pure/exceptval.py
blob: 3d991f7c18aeb214d1721fba6e1f1fd224c34e7e (plain)
1
2
3
4
5
6
7
import cython

@cython.exceptval(-1)
def func(x: cython.int) -> cython.int:
    if x < 0:
        raise ValueError("need integer >= 0")
    return x + 1