numpy 1.22.4 Pypi GitHub Homepage
Other Docs
ParametersReturns
build_and_import_extension(modname, functions, *, prologue='', build_dir=None, include_dirs=[], more_init='')

Parameters

functions : list of fragments

Each fragment is a sequence of func_name, calling convention, snippet.

prologue : string

Code to preceed the rest, usually extra #include or #define macros.

build_dir : pathlib.Path

Where to build the module, usually a temporary directory

include_dirs : list

Extra directories to find include files when compiling

more_init : string

Code to appear in the module PyMODINIT_FUNC

Returns

out: module

The module will have been loaded and is ready for use

Build and imports a c-extension module :None:None:`modname` from a list of function fragments :None:None:`functions`.

Examples

This example does not not appear to be valid Python Syntax
>>> functions = [("test_bytes", "METH_O", """
    if ( !PyBytesCheck(args)) {
        Py_RETURN_FALSE;
    }
    Py_RETURN_TRUE;
""")]
This example is valid syntax, but we were not able to check execution
>>> mod = build_and_import_extension("testme", functions)
... assert not mod.test_bytes(u'abc')
... assert mod.test_bytes(b'abc')
See :

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


GitHub : /numpy/testing/_private/extbuild.py#15
type: <class 'function'>
Commit: