File: inlinepxd.pyx

package info (click to toggle)
cython 3.0.11%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 19,092 kB
  • sloc: python: 83,539; ansic: 18,831; cpp: 1,402; xml: 1,031; javascript: 511; makefile: 403; sh: 204; sed: 11
file content (52 lines) | stat: -rw-r--r-- 744 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# mode: run
# tag: inline, pxd

# cython: wraparound = False

__doc__ = u"""
>>> f()
3
>>> g()
6
>>> h()
6
>>> i()
6
>>> j()
6
"""

cimport inlinepxd_support
from inlinepxd_support cimport my_add as my_add3

def f():
    return my_add(1, 2)

def g():
    return inlinepxd_support.my_add(1, 2, 3)

def h():
    return my_add3(1, 2, 3)

def i():
    return my_add3(5)

def j():
    return my_add3(2, 4)

def test_wraparound():
    """
    >>> test_wraparound()
    1.0
    """
    # the wraparound directive from this scope should not affect the inline pxd
    a = [ 0.0, 1.0 ]
    return inlinepxd_support.index(a)


def test_call_inlined(L):
    """
    >>> test_call_inlined([1, 2, 3])
    3
    """
    return inlinepxd_support.call_index(L)