title: PyFunctionObject crash the programm in Py_Finalize if it has being set item in PyTuple
body: <p>I need get list of function name and signatures by python file.
  Python function <code>inspect.signature</code> can get me function signature.
  But <code>inspect.signature</code> need a function object (<code>PyFunctionObject</code>).
  <code>inspect.getmembers</code> can return such object.
  But if I set <code>PyFunctionObject</code> as item in <code>PyTuple</code>, when <code>Py_Finalize</code> is executed - I get error.
  Also, I'm using Qt.</p>
  
  <p>So line <code>PyTuple_SetItem(pFuncLink_arg, 0, pGetmember_tupleList);</code> result error.</p>
  
  <p>Code:.</p>
  
  <pre><code>PyObject *pName, *pModule;
  PyObject *pInspect_module_name, *pInspect_module;
  PyObject *pGetmember_function, *pGetmember_call_args, *pGetmembers_reply, *pGetsignature_function, *pGetmember_itemList, *pGetmember_tupleList;
  PyObject *pFuncName, *pFuncLink_arg, *pFuncSign;
  
  Py_Initialize();
  
  QFileInfo fileInfo(QFile("X:/Projects/p-text.py"));
  QString absPath = fileInfo.absolutePath();
  
  QString fileName = fileInfo.baseName();
  
  PyObject* sysPath = PySys_GetObject((char*)"path"); 
  PyObject* programName = PyUnicode_FromString(absPath.toAscii());
  PyList_Append(sysPath, programName);
  
  pName = PyUnicode_FromString(fileName.toLatin1());
  pModule = PyImport_Import(pName);
  Py_DECREF(pName);
  
  if (pModule != NULL){
      pInspect_module_name = PyUnicode_DecodeFSDefault("inspect");
      pInspect_module = PyImport_Import(pInspect_module_name);
      pGetmember_function = PyObject_GetAttrString(pInspect_module, "getmembers");    
      pGetsignature_function = PyObject_GetAttrString(pInspect_module, "signature");
  
      pGetmember_call_args = PyTuple_New(1);
      PyTuple_SetItem(pGetmember_call_args, 0, pModule);
      pGetmembers_reply = PyObject_CallObject(pGetmember_function, pGetmember_call_args);
  
      if (pGetmembers_reply){
          Py_ssize_t const num_args = PyList_Size(pGetmembers_reply);
          for (Py_ssize_t i = 0; i &lt; num_args; ++i){
              pGetmember_itemList = PyList_GetItem(pGetmembers_reply, i);
              pGetmember_tupleList =  PyTuple_GetItem(pGetmember_itemList, 1);
  
              if (PyFunction_Check(pGetmember_tupleList)){
                  pFuncName =  PyTuple_GetItem(pGetmember_itemList, 0);
                  QString funcName = PyObjectToString(pFuncName);
                      Py_DECREF(pFuncName);
  
                  pFuncLink_arg = PyTuple_New(1);
                  PyTuple_SetItem(pFuncLink_arg, 0, pGetmember_tupleList);
  
                  pFuncSign = PyObject_CallObject(pGetsignature_function, pFuncLink_arg);
  
                  if (pFuncSign == NULL) {
                      if (PyErr_Occurred()) {
                          PyErr_Print(); 
                      }
                      return;
                  }
  
                  QString funcSign = PyObjectToString(pFuncSign);
  
                  Py_DECREF(pFuncSign);
  
                  cout&lt;&lt;funcSign.toStdString()&lt;&lt;endl;
              }
  
              Py_DECREF(pGetmember_tupleList);
              Py_DECREF(pGetmember_itemList);
          }
      }
      Py_DECREF(pInspect_module_name);
      Py_DECREF(pInspect_module);
      Py_DECREF(pGetmember_function);
      Py_DECREF(pGetsignature_function);
      Py_DECREF(pGetmember_call_args);
  }
  else {
      PyErr_Print();
  }
  
  Py_Finalize();
  </code></pre>
  
  <p><code>Py_Finalize()</code> throws an error 
  "project_name.exe has triggered a breakpoint"</p>