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:
@@ -103,8 +103,8 @@ public:
|
||||
//@{
|
||||
static int __setattro(PyObject *PyObj, PyObject *attro, PyObject *value);
|
||||
//@}
|
||||
PyObject *_getattr(char *attr); // __getattr__ function
|
||||
int _setattr(char *attr, PyObject *value); // __setattr__ function
|
||||
PyObject *_getattr(const char *attr); // __getattr__ function
|
||||
int _setattr(const char *attr, PyObject *value); // __setattr__ function
|
||||
|
||||
protected:
|
||||
PyObject * dict_methods;
|
||||
|
||||
@@ -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__")) {
|
||||
|
||||
Reference in New Issue
Block a user