diff --git a/src/PythonQt.cpp b/src/PythonQt.cpp index 3b33cdec..ca98c3c7 100644 --- a/src/PythonQt.cpp +++ b/src/PythonQt.cpp @@ -58,7 +58,6 @@ #include -#include #include PythonQt* PythonQt::_self = NULL; @@ -2423,22 +2422,27 @@ QString PythonQtPrivate::getSignature(PyObject* object) // inspect.getargs() can handle anonymous (tuple) arguments, while this code does not. // It can be implemented, but it may be rarely needed and not necessary. PyCodeObject* code = (PyCodeObject*)func->func_code; - if (code->co_varnames) { +#if PY_VERSION_HEX < (3 << 24 | 11 << 16) + PyObject* co_varnames = code->co_varnames; +#else + PyObject* co_varnames = PyCode_GetVarnames(code); +#endif + if (co_varnames) { int nargs = code->co_argcount; - Q_ASSERT(PyTuple_Check(code->co_varnames)); + Q_ASSERT(PyTuple_Check(co_varnames)); for (int i=0; ico_varnames, i); + PyObject* name = PyTuple_GetItem(co_varnames, i); Q_ASSERT(PyString_Check(name)); arguments << PyString_AsString(name); } if (code->co_flags & CO_VARARGS) { - PyObject* s = PyTuple_GetItem(code->co_varnames, nargs); + PyObject* s = PyTuple_GetItem(co_varnames, nargs); Q_ASSERT(PyString_Check(s)); varargs = PyString_AsString(s); nargs += 1; } if (code->co_flags & CO_VARKEYWORDS) { - PyObject* s = PyTuple_GetItem(code->co_varnames, nargs); + PyObject* s = PyTuple_GetItem(co_varnames, nargs); Q_ASSERT(PyString_Check(s)); varkeywords = PyString_AsString(s); } diff --git a/src/PythonQtClassWrapper.h b/src/PythonQtClassWrapper.h index e136e3d4..53c1d3ca 100644 --- a/src/PythonQtClassWrapper.h +++ b/src/PythonQtClassWrapper.h @@ -49,7 +49,6 @@ #include "structmember.h" #include "methodobject.h" #include "compile.h" -#include "eval.h" #include class PythonQtClassInfo; diff --git a/src/PythonQtInstanceWrapper.h b/src/PythonQtInstanceWrapper.h index 8c04d03e..26ac6a0e 100644 --- a/src/PythonQtInstanceWrapper.h +++ b/src/PythonQtInstanceWrapper.h @@ -51,7 +51,6 @@ #include "structmember.h" #include "methodobject.h" #include "compile.h" -#include "eval.h" class PythonQtClassInfo; class QObject; diff --git a/src/PythonQtSignalReceiver.cpp b/src/PythonQtSignalReceiver.cpp index 734ec017..b68988be 100644 --- a/src/PythonQtSignalReceiver.cpp +++ b/src/PythonQtSignalReceiver.cpp @@ -45,7 +45,6 @@ #include "PythonQtConversion.h" #include #include -#include "funcobject.h" // use -2 to signal that the variable is uninitialized int PythonQtSignalReceiver::_destroyedSignal1Id = -2;