title: Writing a Python C extension: how to correctly load a PyListObject?
body: <p>While attempting to read a Python list filled with float numbers and to populate <code>real channels[7]</code> with their values (I'm using F2C, so real is just a typedef for float), all I am able to retrieve from it are zero values. Can you point out the error in the code below?</p>
  
  <pre><code>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!", &amp;PyList_Type, &amp;input)) {
      return NULL;
    }
    for (i = 0; i &lt; PyList_Size(input); i++) {
      printf("%f\n", PyList_GetItem(input, (Py_ssize_t)i)); // &lt;--- Prints zeros
    }
  //....
  }
  </code></pre>