Cython has moved to github.
cython-devel
view tests/run/modop.pyx @ 1622:4f0327bdebc9
test for temp allocation bug in call
| author | Robert Bradshaw <robertwb@math.washington.edu> |
|---|---|
| date | Sat Jan 17 01:25:34 2009 -0800 (3 years ago) |
| parents | f57de7fc2b36 |
| children | 82d312a9f1fc |
line source
1 __doc__ = u"""
2 >>> modobj(9,2)
3 1
4 >>> modobj('%d', 5)
5 '5'
7 >>> modint(9,2)
8 1
9 """
11 import sys
12 if sys.version_info[0] < 3:
13 __doc__ = __doc__ + u"""
15 >>> modptr()
16 'spameggs'
17 """
19 def modobj(obj2, obj3):
20 obj1 = obj2 % obj3
21 return obj1
23 def modint(int int2, int int3):
24 cdef int int1
25 int1 = int2 % int3
26 return int1
28 def modptr():
29 cdef char *str2, *str3
30 str2 = "spam%s"
31 str3 = "eggs"
33 obj1 = str2 % str3 # '%' operator doesn't work on byte strings in Py3
34 return obj1
