blob: aaf3fef4f5dc5d49e9f0322867a959235f58ae43 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
|
from libc.stdlib cimport free
from c_func cimport c_call_returning_a_c_string
def main():
cdef char* c_string = c_call_returning_a_c_string()
cdef bytes py_string = c_string
# A type cast to `object` or `bytes` will do the same thing:
py_string = <bytes> c_string
free(c_string)
|