Warnings removal

This commit is contained in:
xarkes 2018-02-22 19:51:02 +01:00 committed by xarkes
parent d23cc71b79
commit 3b8bdb6995

View File

@ -47,9 +47,10 @@ PyObject *PyInit_api()
PyObject *api_internal_launch_ipykernel(PyObject *self, PyObject *args, PyObject *kw) PyObject *api_internal_launch_ipykernel(PyObject *self, PyObject *args, PyObject *kw)
{ {
QStringList argv; Q_UNUSED(self);
Q_UNUSED(kw);
{ QStringList argv;
PyObject *argvListObject; PyObject *argvListObject;
if (!PyArg_ParseTuple(args, "O", &argvListObject) if (!PyArg_ParseTuple(args, "O", &argvListObject)
@ -59,19 +60,15 @@ PyObject *api_internal_launch_ipykernel(PyObject *self, PyObject *args, PyObject
return nullptr; return nullptr;
} }
for (int i=0; i<PyList_Size(argvListObject); i++) for (int i = 0; i < PyList_Size(argvListObject); i++)
{ {
PyObject *o = PyList_GetItem(argvListObject, i); PyObject *o = PyList_GetItem(argvListObject, i);
QString s = QString::fromUtf8(PyUnicode_AsUTF8(o)); QString s = QString::fromUtf8(PyUnicode_AsUTF8(o));
argv.append(s); argv.append(s);
} }
}
PyThreadState *parentThreadState = PyThreadState_Get(); PyThreadState *parentThreadState = PyThreadState_Get();
PyThreadState *threadState = Py_NewInterpreter();
QFile moduleFile(":/python/cutter_ipykernel.py"); QFile moduleFile(":/python/cutter_ipykernel.py");
moduleFile.open(QIODevice::ReadOnly); moduleFile.open(QIODevice::ReadOnly);
QByteArray moduleCode = moduleFile.readAll(); QByteArray moduleCode = moduleFile.readAll();
@ -93,15 +90,15 @@ PyObject *api_internal_launch_ipykernel(PyObject *self, PyObject *args, PyObject
auto launchFunc = PyObject_GetAttrString(cutterIPykernelModule, "launch_ipykernel"); auto launchFunc = PyObject_GetAttrString(cutterIPykernelModule, "launch_ipykernel");
PyObject *argvListObject = PyList_New(argv.size()); argvListObject = PyList_New(argv.size());
for (int i=0; i<argv.size(); i++) for (int i = 0; i < argv.size(); i++)
{ {
QString s = argv[i]; QString s = argv[i];
PyList_SetItem(argvListObject, i, PyUnicode_DecodeUTF8(s.toUtf8().constData(), s.length(), nullptr)); PyList_SetItem(argvListObject, i, PyUnicode_DecodeUTF8(s.toUtf8().constData(), s.length(), nullptr));
} }
auto ipyKernel = PyObject_CallFunction(launchFunc, "O", argvListObject); auto ipyKernel = PyObject_CallFunction(launchFunc, "O", argvListObject);
Q_UNUSED(ipyKernel);
PyThreadState_Swap(parentThreadState); PyThreadState_Swap(parentThreadState);