summaryrefslogtreecommitdiff
path: root/docs/examples/tutorial/array/unsafe_usage.pyx
blob: d1f498c68126011c8e9615fda8ed2a0c45306357 (plain)
1
2
3
4
5
6
7
8
9
10
11
from cpython cimport array
import array

cdef array.array a = array.array('i', [1, 2, 3])

# access underlying pointer:
print(a.data.as_ints[0])

from libc.string cimport memset

memset(a.data.as_voidptr, 0, len(a) * sizeof(int))