Cython has moved to github.

cython-devel

view tests/run/r_pythonapi.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 dedba376763b
children 45e628719226
line source
1 __doc__ = u"""
2 >>> x = spam()
3 >>> print(repr(x))
4 u'Ftang\\x00Ftang!'
5 """
7 import sys
8 if sys.version_info[0] >= 3:
9 __doc__ = __doc__.replace(u" u'", u" '")
11 cdef extern from "string.h":
12 void memcpy(char *d, char *s, int n)
14 from python_unicode cimport PyUnicode_DecodeUTF8
16 def spam():
17 cdef char buf[12]
18 memcpy(buf, "Ftang\0Ftang!", sizeof(buf))
19 return PyUnicode_DecodeUTF8(buf, sizeof(buf), NULL)