New submission from Espie Marc: Documentation says PyList_SET_ITEM is void, but it lies. The macro is such that it yields the actual element being set.
wrapping the macro content in a do {} while (0) makes sure PyList_SET_ITEM is really void, e.g.: #define PyList_SET_ITEM(op, i, v) do { (((PyListObject *)(op))->ob_item[i] = (v)); } while (0) I just ran into the problem while compiling py-qt4 with clang. There was some confusion between PyList_SET_ITEM and PyList_SetItem: if (obj == NULL || PyList_SET_ITEM (l, i, obj) < 0) g++ didn't catch it (because it doesn't see negative pointers as a problem), but clang++ instantly broke. With PyList_SET_ITEM truly void the problem disappears. ---------- components: Interpreter Core messages: 294362 nosy: espie priority: normal severity: normal status: open title: PyList_SET_ITEM could be safer type: enhancement versions: Python 3.6 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue30459> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com