Show More
@@ -175,7 +175,22 b' static PyObject* bserobj_getattrro(PyObj' | |||||
175 | const char* item_name = NULL; |
|
175 | const char* item_name = NULL; | |
176 | PyObject* key = PyTuple_GET_ITEM(obj->keys, i); |
|
176 | PyObject* key = PyTuple_GET_ITEM(obj->keys, i); | |
177 |
|
177 | |||
178 | item_name = PyBytes_AsString(key); |
|
178 | if (PyUnicode_Check(key)) { | |
|
179 | #if PY_MAJOR_VERSION >= 3 | |||
|
180 | item_name = PyUnicode_AsUTF8(key); | |||
|
181 | #else | |||
|
182 | PyObject* utf = PyUnicode_AsEncodedString(key, "utf-8", "ignore"); | |||
|
183 | if (utf == NULL) { | |||
|
184 | goto bail; | |||
|
185 | } | |||
|
186 | item_name = PyBytes_AsString(utf); | |||
|
187 | #endif | |||
|
188 | } else { | |||
|
189 | item_name = PyBytes_AsString(key); | |||
|
190 | } | |||
|
191 | if (item_name == NULL) { | |||
|
192 | goto bail; | |||
|
193 | } | |||
179 | if (!strcmp(item_name, namestr)) { |
|
194 | if (!strcmp(item_name, namestr)) { | |
180 | ret = PySequence_GetItem(obj->values, i); |
|
195 | ret = PySequence_GetItem(obj->values, i); | |
181 | goto bail; |
|
196 | goto bail; |
General Comments 0
You need to be logged in to leave comments.
Login now