From 97701e3a73eb9420f4646dec525632efeac71413 Mon Sep 17 00:00:00 2001 From: wmayer Date: Mon, 8 Jun 2020 20:29:39 +0200 Subject: [PATCH] Py3.8: [skip ci] missing initializer for member '_typeobject::tp_vectorcall' [-Wmissing-field-initializers] --- src/App/FeaturePythonPyImp.h | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/App/FeaturePythonPyImp.h b/src/App/FeaturePythonPyImp.h index 104c16d6d5..04123c020d 100644 --- a/src/App/FeaturePythonPyImp.h +++ b/src/App/FeaturePythonPyImp.h @@ -37,7 +37,28 @@ virtual ~_class_(); \ }; -#if PY_MAJOR_VERSION >= 3 +#if PY_VERSION_HEX >= 0x03080000 +#define PYTHON_TYPE_IMP(_class_, _subclass_) \ + PyTypeObject _class_::Type = { \ + PyVarObject_HEAD_INIT(&PyType_Type, 0) \ + ""#_class_"", \ + sizeof(_class_), \ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, \ + Py_TPFLAGS_BASETYPE|Py_TPFLAGS_DEFAULT, \ + ""#_class_"", \ + 0, 0, 0, 0, 0, 0, 0, 0, 0, \ + &_subclass_::Type, \ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 \ + }; \ + _class_::_class_(Base::BaseClass *pcObject, PyTypeObject *T) \ + : _subclass_(reinterpret_cast<_subclass_::PointerType>(pcObject), T) \ + { \ + } \ + _class_::~_class_() \ + { \ + } + +#elif PY_MAJOR_VERSION >= 3 #define PYTHON_TYPE_IMP(_class_, _subclass_) \ PyTypeObject _class_::Type = { \ PyVarObject_HEAD_INIT(&PyType_Type, 0) \