

def build_increment_ext():
    ' Build a simple extension with functions that increment numbers.\n        The extension will be built in the local directory.\n    '
    mod = ext_tools.ext_module('increment_ext')
    a = 1
    ext_code = 'return_val = PyInt_FromLong(a+1);'
    func = ext_tools.ext_function('increment', ext_code, ['a'])
    mod.add_function(func)
    ext_code = 'return_val = PyInt_FromLong(a+2);'
    func = ext_tools.ext_function('increment_by_2', ext_code, ['a'])
    mod.add_function(func)
    mod.compile()

dataset/ETHPy150Open scipy/scipy/scipy/weave/examples/increment_example.py build_increment_ext/original