title: python-c-api reference count
body: <p>My python code pass some dictionary and lists to C like this:</p>
  
  <pre><code>if (!PyArg_ParseTuple(args, "O!lO!O!O!O!O!", &amp;PyList_Type,&amp;list,&amp;los,&amp;PyDict_Type,&amp;entity_len,&amp;PyDict_Type,&amp;inlist_len,&amp;PyList_Type,&amp;inindex,&amp;PyDict_Type,&amp;inlist,&amp;PyList_Type,&amp;tokens))
          return NULL; 
  </code></pre>
  
  <p>is that OK to get items like this?</p>
  
  <pre><code>int i = PyInt_AS_LONG(PyList_GetItem(PyDict_GetItem(inlist,PyList_GetItem(tokens,pi)),current_index[pi]))
  </code></pre>
  
  <p>I need to call my C function in python for 10K times, and after running my code for about 100 times, it shows segment fault 11. How can I fixed it?  </p>