Cython has moved to github.
cython-devel
view tests/run/kwargproblems.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 | 6309e21af543 |
| children | 82d312a9f1fc |
line source
1 __doc__ = u"""
2 >>> d = {1 : 2}
3 >>> test(**d)
4 Traceback (most recent call last):
5 TypeError: test() keywords must be strings
6 >>> d
7 {1: 2}
9 >>> d = {}
10 >>> test(**d)
11 {'arg': 3}
12 >>> d
13 {}
15 >>> d = {'arg' : 2} # this should be u'arg', but Py2 can't handle it...
16 >>> test(**d)
17 {'arg': 3}
18 >>> d
19 {'arg': 2}
20 """
22 import sys
24 def test(**kw):
25 if sys.version_info[0] >= 3:
26 kw[u'arg'] = 3
27 else:
28 kw['arg'] = 3
29 return kw
