py3: Gui: files A-P ported to python3

This commit is contained in:
Yorik van Havre
2017-05-05 19:33:03 +02:00
committed by wmayer
parent 3299c363ab
commit 7e39fed862
10 changed files with 274 additions and 25 deletions

View File

@@ -234,7 +234,11 @@ QMap<QString, CallTip> CallTipsList::extractTips(const QString& context) const
PyObject* eval = 0;
if (PyCode_Check(code)) {
#if PY_MAJOR_VERSION >= 3
eval = PyEval_EvalCode(code, dict.ptr(), dict.ptr());
#else
eval = PyEval_EvalCode(reinterpret_cast<PyCodeObject*>(code), dict.ptr(), dict.ptr());
#endif
}
Py_DECREF(code);
if (!eval) {
@@ -270,12 +274,14 @@ QMap<QString, CallTip> CallTipsList::extractTips(const QString& context) const
else if (PyObject_IsSubclass(type.ptr(), typeobj.o) == 1) {
obj = type;
}
#if PY_MAJOR_VERSION < 3
else if (PyInstance_Check(obj.ptr())) {
// instances of old style classes
PyInstanceObject* inst = reinterpret_cast<PyInstanceObject*>(obj.ptr());
PyObject* classobj = reinterpret_cast<PyObject*>(inst->in_class);
obj = Py::Object(classobj);
}
#endif
else if (PyObject_IsInstance(obj.ptr(), basetype.o) == 1) {
// New style class which can be a module, type, list, tuple, int, float, ...
// Make sure it's not a type objec