App: remove Py2 code from several src/App .cpp files
This commit is contained in:
@@ -49,11 +49,7 @@ PyTypeObject FeaturePythonPyT<FeaturePyT>::Type = {
|
||||
/* --- Functions to access object as input/output buffer ---------*/
|
||||
0, /* tp_as_buffer */
|
||||
/* --- Flags to define presence of optional/expanded features */
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
Py_TPFLAGS_BASETYPE|Py_TPFLAGS_DEFAULT, /*tp_flags */
|
||||
#else
|
||||
Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_CLASS, /*tp_flags */
|
||||
#endif
|
||||
"This is the father of all Feature classes", /*tp_doc */
|
||||
0, /*tp_traverse */
|
||||
0, /*tp_clear */
|
||||
@@ -81,9 +77,7 @@ PyTypeObject FeaturePythonPyT<FeaturePyT>::Type = {
|
||||
0, /*tp_weaklist */
|
||||
0, /*tp_del */
|
||||
0 /*tp_version_tag */
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
,0 /*tp_finalize */
|
||||
#endif
|
||||
#if PY_VERSION_HEX >= 0x03080000
|
||||
,0 /*tp_vectorcall */
|
||||
#endif
|
||||
@@ -108,11 +102,7 @@ template<class FeaturePyT>
|
||||
int FeaturePythonPyT<FeaturePyT>::__setattro(PyObject *obj, PyObject *attro, PyObject *value)
|
||||
{
|
||||
const char *attr;
|
||||
#if PY_MAJOR_VERSION >= 3
|
||||
attr = PyUnicode_AsUTF8(attro);
|
||||
#else
|
||||
attr = PyString_AsString(attro);
|
||||
#endif
|
||||
// This overwrites PyObjectBase::__setattr because this actively disallows to delete an attribute
|
||||
//
|
||||
|
||||
@@ -144,11 +134,7 @@ int FeaturePythonPyT<FeaturePyT>::_setattr(const char *attr, PyObject *value)
|
||||
if (value) {
|
||||
if (PyFunction_Check(value)) {
|
||||
PyErr_Clear();
|
||||
#if PY_MAJOR_VERSION < 3
|
||||
dict_item = PyMethod_New(value, this, 0);
|
||||
#else
|
||||
dict_item = PyMethod_New(value, this);
|
||||
#endif
|
||||
returnValue = PyDict_SetItemString(dict_methods, attr, dict_item);
|
||||
Py_XDECREF(dict_item);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user