Removed old Python code <3.10
This commit is contained in:
@@ -48,12 +48,9 @@
|
||||
|
||||
#if PY_VERSION_HEX >= 0x030c0000
|
||||
#define PYTHON_TYPE_SLOTS 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||
#elif PY_VERSION_HEX >= 0x03090000
|
||||
#define PYTHON_TYPE_SLOTS 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||
#elif PY_VERSION_HEX >= 0x03080000
|
||||
#define PYTHON_TYPE_SLOTS 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||
#else
|
||||
#define PYTHON_TYPE_SLOTS 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||
#define PYTHON_TYPE_SLOTS 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
|
||||
|
||||
#endif \
|
||||
|
||||
#define PYTHON_TYPE_IMP(_class_, _subclass_) \
|
||||
|
||||
@@ -34,11 +34,7 @@ PyTypeObject FeaturePythonPyT<FeaturePyT>::Type = {
|
||||
0, /*tp_itemsize*/
|
||||
/* methods */
|
||||
FeaturePyT::PyDestructor, /*tp_dealloc*/
|
||||
#if PY_VERSION_HEX >= 0x03080000
|
||||
0, /*tp_vectorcall_offset*/
|
||||
#else
|
||||
nullptr, /*tp_print*/
|
||||
#endif
|
||||
nullptr, /*tp_getattr*/
|
||||
nullptr, /*tp_setattr*/
|
||||
nullptr, /*tp_compare*/
|
||||
@@ -83,12 +79,10 @@ PyTypeObject FeaturePythonPyT<FeaturePyT>::Type = {
|
||||
nullptr, /*tp_del */
|
||||
0, /*tp_version_tag */
|
||||
nullptr /*tp_finalize */
|
||||
#if PY_VERSION_HEX >= 0x03080000
|
||||
,0 /*tp_vectorcall */
|
||||
#if PY_VERSION_HEX >= 0x030c0000
|
||||
,0 /*tp_watched */
|
||||
#endif
|
||||
#endif
|
||||
};
|
||||
|
||||
template<class FeaturePyT>
|
||||
|
||||
@@ -485,8 +485,6 @@ void InterpreterSingleton::runFile(const char* pxFileName, bool local)
|
||||
|
||||
bool InterpreterSingleton::loadModule(const char* psModName)
|
||||
{
|
||||
// buffer acrobatics
|
||||
// PyBuf ModName(psModName);
|
||||
PyObject* module {};
|
||||
|
||||
PyGILStateLocker locker;
|
||||
@@ -567,10 +565,6 @@ const char* InterpreterSingleton::init(int argc, char* argv[])
|
||||
" exec(open(activate_this).read(), {'__file__':activate_this})\n");
|
||||
}
|
||||
|
||||
#if PY_VERSION_HEX < 0x03090000
|
||||
PyEval_InitThreads();
|
||||
#endif
|
||||
|
||||
size_t size = argc;
|
||||
static std::vector<wchar_t*> _argv(size);
|
||||
for (int i = 0; i < argc; i++) {
|
||||
@@ -774,11 +768,7 @@ void InterpreterSingleton::runMethod(PyObject* pobject,
|
||||
throw TypeError("InterpreterSingleton::RunMethod() wrong arguments");
|
||||
}
|
||||
|
||||
#if PY_VERSION_HEX < 0x03090000
|
||||
presult = PyEval_CallObject(pmeth, pargs); /* run interpreter */
|
||||
#else
|
||||
presult = PyObject_CallObject(pmeth, pargs); /* run interpreter */
|
||||
#endif
|
||||
|
||||
Py_DECREF(pmeth);
|
||||
Py_DECREF(pargs);
|
||||
|
||||
@@ -116,18 +116,13 @@ PyBaseProxy_dealloc(PyObject* self)
|
||||
}
|
||||
Py_TYPE(self)->tp_free(self);
|
||||
}
|
||||
|
||||
static PyTypeObject PyBaseProxyType = {
|
||||
PyVarObject_HEAD_INIT(nullptr, 0)
|
||||
"PyBaseProxy", /*tp_name*/
|
||||
sizeof(PyBaseProxy), /*tp_basicsize*/
|
||||
0, /*tp_itemsize*/
|
||||
PyBaseProxy_dealloc, /*tp_dealloc*/
|
||||
#if PY_VERSION_HEX >= 0x03080000
|
||||
0, /*tp_vectorcall_offset*/
|
||||
#else
|
||||
nullptr, /*tp_print*/
|
||||
#endif
|
||||
nullptr, /*tp_getattr*/
|
||||
nullptr, /*tp_setattr*/
|
||||
nullptr, /*tp_compare*/
|
||||
@@ -170,16 +165,11 @@ static PyTypeObject PyBaseProxyType = {
|
||||
nullptr, /*tp_del */
|
||||
0, /*tp_version_tag */
|
||||
nullptr /*tp_finalize */
|
||||
#if PY_VERSION_HEX >= 0x03090000
|
||||
,0 //NOLINT /*tp_vectorcall */
|
||||
#if PY_VERSION_HEX >= 0x030c0000
|
||||
,0 /*tp_watched */
|
||||
#endif
|
||||
#elif PY_VERSION_HEX >= 0x03080000
|
||||
,0 /*tp_vectorcall */
|
||||
/* bpo-37250: kept for backwards compatibility in CPython 3.8 only */
|
||||
,0 /*tp_print */
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
PyTypeObject PyObjectBase::Type = {
|
||||
@@ -189,11 +179,7 @@ PyTypeObject PyObjectBase::Type = {
|
||||
0, /*tp_itemsize*/
|
||||
/* --- methods ---------------------------------------------- */
|
||||
PyDestructor, /*tp_dealloc*/
|
||||
#if PY_VERSION_HEX >= 0x03080000
|
||||
0, /*tp_vectorcall_offset*/
|
||||
#else
|
||||
nullptr, /*tp_print*/
|
||||
#endif
|
||||
nullptr, /*tp_getattr*/
|
||||
nullptr, /*tp_setattr*/
|
||||
nullptr, /*tp_compare*/
|
||||
@@ -238,16 +224,10 @@ PyTypeObject PyObjectBase::Type = {
|
||||
nullptr, /*tp_del */
|
||||
0, /*tp_version_tag */
|
||||
nullptr /*tp_finalize */
|
||||
#if PY_VERSION_HEX >= 0x03090000
|
||||
,0 //NOLINT /*tp_vectorcall */
|
||||
#if PY_VERSION_HEX >= 0x030c0000
|
||||
,0 /*tp_watched */
|
||||
#endif
|
||||
#elif PY_VERSION_HEX >= 0x03080000
|
||||
,0 /*tp_vectorcall */
|
||||
/* bpo-37250: kept for backwards compatibility in CPython 3.8 only */
|
||||
,0 /*tp_print */
|
||||
#endif
|
||||
};
|
||||
|
||||
#if defined(__clang__)
|
||||
|
||||
@@ -54,11 +54,7 @@ PP_Run_Method(PyObject *pobject, const char *method,
|
||||
if (PP_DEBUG) /* debug it too? */
|
||||
presult = PP_Debug_Function(pmeth, pargs);
|
||||
else
|
||||
#if PY_VERSION_HEX < 0x03090000
|
||||
presult = PyEval_CallObject(pmeth, pargs); /* run interpreter */
|
||||
#else
|
||||
presult = PyObject_CallObject(pmeth, pargs); /* run interpreter */
|
||||
#endif
|
||||
|
||||
Py_DECREF(pmeth);
|
||||
Py_DECREF(pargs);
|
||||
@@ -131,11 +127,7 @@ PP_Run_Function(const char *modname, const char *funcname, /* load from
|
||||
if (PP_DEBUG && strcmp(modname, "pdb") != 0) /* debug this call? */
|
||||
presult = PP_Debug_Function(func, args); /* run in pdb; incref'd */
|
||||
else
|
||||
#if PY_VERSION_HEX < 0x03090000
|
||||
presult = PyEval_CallObject(func, args); /* run function; incref'd */
|
||||
#else
|
||||
presult = PyObject_CallObject(func, args); /* run function; incref'd */
|
||||
#endif
|
||||
|
||||
Py_DECREF(func);
|
||||
Py_DECREF(args); /* result may be None */
|
||||
@@ -183,11 +175,7 @@ PP_Run_Known_Callable(PyObject *object, /* func|class|method */
|
||||
if (PP_DEBUG) /* debug this call? */
|
||||
presult = PP_Debug_Function(object, args); /* run in pdb; incref'd */
|
||||
else
|
||||
#if PY_VERSION_HEX < 0x03090000
|
||||
presult = PyEval_CallObject(object, args); /* run function; incref'd */
|
||||
#else
|
||||
presult = PyObject_CallObject(object, args); /* run function; incref'd */
|
||||
#endif
|
||||
|
||||
Py_DECREF(args); /* result may be None */
|
||||
return PP_Convert_Result(presult, resfmt, cresult); /* convert result to C*/
|
||||
|
||||
@@ -123,11 +123,7 @@ InteractiveInterpreter::InteractiveInterpreter()
|
||||
PyObject* func = PyObject_GetAttrString(module, "InteractiveInterpreter");
|
||||
PyObject* args = Py_BuildValue("()");
|
||||
d = new InteractiveInterpreterP;
|
||||
#if PY_VERSION_HEX < 0x03090000
|
||||
d->interpreter = PyEval_CallObject(func,args);
|
||||
#else
|
||||
d->interpreter = PyObject_CallObject(func,args);
|
||||
#endif
|
||||
Py_DECREF(args);
|
||||
Py_DECREF(func);
|
||||
Py_DECREF(module);
|
||||
@@ -175,11 +171,7 @@ PyObject* InteractiveInterpreter::compile(const char* source) const
|
||||
Base::PyGILStateLocker lock;
|
||||
PyObject* func = PyObject_GetAttrString(d->interpreter, "compile");
|
||||
PyObject* args = Py_BuildValue("(s)", source);
|
||||
#if PY_VERSION_HEX < 0x03090000
|
||||
PyObject* eval = PyEval_CallObject(func,args); // must decref later
|
||||
#else
|
||||
PyObject* eval = PyObject_CallObject(func,args); // must decref later
|
||||
#endif
|
||||
|
||||
Py_XDECREF(args);
|
||||
Py_XDECREF(func);
|
||||
@@ -211,11 +203,7 @@ int InteractiveInterpreter::compileCommand(const char* source) const
|
||||
Base::PyGILStateLocker lock;
|
||||
PyObject* func = PyObject_GetAttrString(d->interpreter, "compile");
|
||||
PyObject* args = Py_BuildValue("(s)", source);
|
||||
#if PY_VERSION_HEX < 0x03090000
|
||||
PyObject* eval = PyEval_CallObject(func,args); // must decref later
|
||||
#else
|
||||
PyObject* eval = PyObject_CallObject(func,args); // must decref later
|
||||
#endif
|
||||
|
||||
Py_DECREF(args);
|
||||
Py_DECREF(func);
|
||||
|
||||
@@ -176,9 +176,7 @@ Py::Object PythonDebugStdout::repr()
|
||||
Py::Object PythonDebugStdout::write(const Py::Tuple& args)
|
||||
{
|
||||
char *msg;
|
||||
//PyObject* pObj;
|
||||
////args contains a single parameter which is the string to write.
|
||||
//if (!PyArg_ParseTuple(args.ptr(), "Os:OutputString", &pObj, &msg))
|
||||
//args contains a single parameter which is the string to write.
|
||||
if (!PyArg_ParseTuple(args.ptr(), "s:OutputString", &msg))
|
||||
throw Py::Exception();
|
||||
|
||||
@@ -186,9 +184,6 @@ Py::Object PythonDebugStdout::write(const Py::Tuple& args)
|
||||
{
|
||||
//send it to our stdout
|
||||
printf("%s\n",msg);
|
||||
|
||||
//send it to the debugger as well
|
||||
//g_DebugSocket.SendMessage(eMSG_OUTPUT, msg);
|
||||
}
|
||||
return Py::None();
|
||||
}
|
||||
@@ -224,19 +219,12 @@ Py::Object PythonDebugStderr::repr()
|
||||
Py::Object PythonDebugStderr::write(const Py::Tuple& args)
|
||||
{
|
||||
char *msg;
|
||||
//PyObject* pObj;
|
||||
//args contains a single parameter which is the string to write.
|
||||
//if (!PyArg_ParseTuple(args.ptr(), "Os:OutputDebugString", &pObj, &msg))
|
||||
if (!PyArg_ParseTuple(args.ptr(), "s:OutputDebugString", &msg))
|
||||
throw Py::Exception();
|
||||
|
||||
if (strlen(msg) > 0)
|
||||
{
|
||||
//send the message to our own stderr
|
||||
//dprintf(msg);
|
||||
|
||||
//send it to the debugger as well
|
||||
//g_DebugSocket.SendMessage(eMSG_TRACE, msg);
|
||||
Base::Console().Error("%s", msg);
|
||||
}
|
||||
|
||||
@@ -275,24 +263,6 @@ Py::Object PythonDebugExcept::excepthook(const Py::Tuple& args)
|
||||
PyErr_NormalizeException(&exc, &value, &tb);
|
||||
|
||||
PyErr_Display(exc, value, tb);
|
||||
/*
|
||||
if (eEXCEPTMODE_IGNORE != g_eExceptionMode)
|
||||
{
|
||||
assert(tb);
|
||||
|
||||
if (tb && (tb != Py_None))
|
||||
{
|
||||
//get the pointer to the frame held by the bottom traceback object - this
|
||||
//should be where the exception occurred.
|
||||
tracebackobject* pTb = (tracebackobject*)tb;
|
||||
while (pTb->tb_next != NULL)
|
||||
{
|
||||
pTb = pTb->tb_next;
|
||||
}
|
||||
PyFrameObject* frame = (PyFrameObject*)PyObject_GetAttr((PyObject*)pTb, PyString_FromString("tb_frame"));
|
||||
EnterBreakState(frame, (PyObject*)pTb);
|
||||
}
|
||||
}*/
|
||||
|
||||
return Py::None();
|
||||
}
|
||||
@@ -542,13 +512,6 @@ void PythonDebugger::hideDebugMarker(const QString& fn)
|
||||
}
|
||||
}
|
||||
|
||||
#if PY_VERSION_HEX < 0x030900B1
|
||||
static PyCodeObject* PyFrame_GetCode(PyFrameObject *frame)
|
||||
{
|
||||
Py_INCREF(frame->f_code);
|
||||
return frame->f_code;
|
||||
}
|
||||
#endif
|
||||
|
||||
// http://www.koders.com/cpp/fidBA6CD8A0FE5F41F1464D74733D9A711DA257D20B.aspx?s=PyEval_SetTrace
|
||||
// http://code.google.com/p/idapython/source/browse/trunk/python.cpp
|
||||
|
||||
@@ -739,11 +739,7 @@ void SignalConnect::onExecute()
|
||||
|
||||
/* Time to call the callback */
|
||||
arglist = Py_BuildValue("(O)", myResource);
|
||||
#if PY_VERSION_HEX < 0x03090000
|
||||
result = PyEval_CallObject(myCallback, arglist);
|
||||
#else
|
||||
result = PyObject_CallObject(myCallback, arglist);
|
||||
#endif
|
||||
Py_XDECREF(result);
|
||||
Py_DECREF(arglist);
|
||||
}
|
||||
|
||||
@@ -190,11 +190,8 @@ static bool callbackWithVertex(Voronoi::diagram_type* dia,
|
||||
#endif
|
||||
PyObject* vx = new VoronoiVertexPy(new VoronoiVertex(dia, v));
|
||||
PyObject* arglist = Py_BuildValue("(O)", vx);
|
||||
#if PY_VERSION_HEX < 0x03090000
|
||||
PyObject* result = PyEval_CallObject(callback, arglist);
|
||||
#else
|
||||
PyObject* result = PyObject_CallObject(callback, arglist);
|
||||
#endif
|
||||
PyObject* result = PyObject_CallObject(callback, arglist);
|
||||
|
||||
Py_DECREF(arglist);
|
||||
Py_DECREF(vx);
|
||||
if (!result) {
|
||||
|
||||
Reference in New Issue
Block a user