py3.7 fix

PyUnicode_AsUTF8() returns const char* in py3.7 instead of char*. Making
changes to reflect that which should also be safe in
other Python versions.
This commit is contained in:
Michal Ulianko
2018-08-17 14:42:21 +02:00
committed by wmayer
parent f721dd9a17
commit 2e2b8cba6a
12 changed files with 34 additions and 34 deletions

View File

@@ -104,7 +104,7 @@ FeaturePythonPyT<FeaturePyT>::~FeaturePythonPyT()
template<class FeaturePyT>
int FeaturePythonPyT<FeaturePyT>::__setattro(PyObject *obj, PyObject *attro, PyObject *value)
{
char *attr;
const char *attr;
#if PY_MAJOR_VERSION >= 3
attr = PyUnicode_AsUTF8(attro);
#else
@@ -127,7 +127,7 @@ int FeaturePythonPyT<FeaturePyT>::__setattro(PyObject *obj, PyObject *attro, PyO
template<class FeaturePyT>
int FeaturePythonPyT<FeaturePyT>::_setattr(char *attr, PyObject *value)
int FeaturePythonPyT<FeaturePyT>::_setattr(const char *attr, PyObject *value)
{
App::Property *prop = FeaturePyT::getPropertyContainerPtr()->getPropertyByName(attr);
if (prop && !value) {
@@ -162,7 +162,7 @@ int FeaturePythonPyT<FeaturePyT>::_setattr(char *attr, PyObject *value)
}
template<class FeaturePyT>
PyObject *FeaturePythonPyT<FeaturePyT>::_getattr(char *attr)
PyObject *FeaturePythonPyT<FeaturePyT>::_getattr(const char *attr)
{
// See CallTipsList::extractTips
if (Base::streq(attr, "__fc_template__")) {