From 98f8879e24aefba67f96a60a33a620e2cf8abaa3 Mon Sep 17 00:00:00 2001 From: wmayer Date: Sat, 3 Jun 2017 02:31:26 +0200 Subject: [PATCH] Py3: in Py2 use string instead of unicode for identifier --- src/Base/PyObjectBase.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Base/PyObjectBase.cpp b/src/Base/PyObjectBase.cpp index 7b17ca4c8b..7595539601 100644 --- a/src/Base/PyObjectBase.cpp +++ b/src/Base/PyObjectBase.cpp @@ -349,11 +349,12 @@ void PyObjectBase::setAttributeOf(const char* attr, PyObject* par) #if PY_MAJOR_VERSION < 3 PyObject* key1 = PyString_FromString("__attribute_of_parent__"); PyObject* key2 = PyString_FromString("__instance_of_parent__"); + PyObject* attro = PyString_FromString(attr); #else PyObject* key1 = PyBytes_FromString("__attribute_of_parent__"); PyObject* key2 = PyBytes_FromString("__instance_of_parent__"); -#endif PyObject* attro = PyUnicode_FromString(attr); +#endif PyDict_SetItem(attrDict, key1, attro); PyDict_SetItem(attrDict, key2, par); Py_DECREF(attro);