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

Method check_type

numpy/distutils/command/config.py:203–230  ·  view source on GitHub ↗

Check type availability. Return True if the type can be compiled, False otherwise

(self, type_name, headers=None, include_dirs=None,
            library_dirs=None)

Source from the content-addressed store, hash-verified

201 return self.try_compile(body, headers, include_dirs)
202
203 def check_type(self, type_name, headers=None, include_dirs=None,
204 library_dirs=None):
205 """Check type availability. Return True if the type can be compiled,
206 False otherwise"""
207 self._check_compiler()
208
209 # First check the type can be compiled
210 body = textwrap.dedent(r"""
211 int main(void) {
212 if ((%(name)s *) 0)
213 return 0;
214 if (sizeof (%(name)s))
215 return 0;
216 }
217 """) % {'name': type_name}
218
219 st = False
220 try:
221 try:
222 self._compile(body % {'type': type_name},
223 headers, include_dirs, 'c')
224 st = True
225 except distutils.errors.CompileError:
226 st = False
227 finally:
228 self._clean()
229
230 return st
231
232 def check_type_size(self, type_name, headers=None, include_dirs=None, library_dirs=None, expected=None):
233 """Check size of a given type."""

Callers 1

check_complexFunction · 0.80

Calls 2

_check_compilerMethod · 0.95
_compileMethod · 0.95

Tested by

no test coverage detected