Py3: in Py2 use string instead of unicode for identifier

This commit is contained in:
wmayer
2017-06-03 02:31:26 +02:00
parent bf162ebde9
commit 34db2e4c55

View File

@@ -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);