Passing a Python list to C function using the Python/C API

前端 未结 2 1202
花落未央
花落未央 2020-12-17 04:20

I\'ve recently started using the Python/C API to build modules for Python using C code. I\'ve been trying to pass a Python list of numbers to a C function without success:

2条回答
  •  眼角桃花
    2020-12-17 04:43

    Would this do to properly free memory?

    PyObject *res;
    res = Py_BuildValue("i", _asdf(pr, pr_length));
    free(pr);
    return res;
    

提交回复
热议问题