Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Writing a Python C extension: how to correctly load a PyListObject?
- static PyObject *orbital_spectra(PyObject *self, PyObject *args) {
- PyListObject *input = (PyListObject*)PyList_New(0);
- real channels[7], coefficients[7], values[240];
- int i;
- if (!PyArg_ParseTuple(args, "O!", &PyList_Type, &input)) {
- return NULL;
- }
- for (i = 0; i < PyList_Size(input); i++) {
- printf("%fn", PyList_GetItem(input, (Py_ssize_t)i)); // <--- Prints zeros
- }
- //....
- }
- printf("%fn", PyFloat_AsDouble(PyList_GetItem(input, (Py_ssize_t)i)));
Advertisement
Add Comment
Please, Sign In to add comment