MCPcopy Create free account
hub / github.com/numpy/numpy / data_source

Class data_source

numpy/core/tests/test_array_interface.py:137–152  ·  view source on GitHub ↗

This class is for testing the timing of the PyCapsule destructor invoked when numpy release its reference to the shared data as part of the numpy array interface protocol. If the PyCapsule destructor is called early the shared data is freed and invalid memory accesse

Source from the content-addressed store, hash-verified

135def test_cstruct(get_module):
136
137 class data_source:
138 """
139 This class is for testing the timing of the PyCapsule destructor
140 invoked when numpy release its reference to the shared data as part of
141 the numpy array interface protocol. If the PyCapsule destructor is
142 called early the shared data is freed and invalid memory accesses will
143 occur.
144 """
145
146 def __init__(self, size, value):
147 self.size = size
148 self.value = value
149
150 @property
151 def __array_struct__(self):
152 return get_module.new_array_struct(self.size, self.value)
153
154 # write to the same stream as the C code
155 stderr = sys.__stderr__

Callers 1

test_cstructFunction · 0.85

Calls

no outgoing calls

Tested by 1

test_cstructFunction · 0.68